With Docker Desktop on Windows the bind-mounted C:\hotel made every page take ~5-7 s; with the code on the Linux filesystem it takes ~0.1 s. - docker/Dockerfile.server bakes the repo into the image (.dockerignore keeps .env, settings.inc.php and caches out) - docker/server-entrypoint.sh copies the code into the app_code volume on start: pass 1 updates code but skips runtime folders (uploads, generated images, caches, downloaded translations, settings.inc.php), pass 2 adds missing files without overwriting - docker/php-server.ini: OPcache without timestamp checks, larger realpath cache - setup script waits for the container and checks the install marker inside the volume; .gitattributes keeps *.sh LF on Windows checkouts - TESTSERVER.md: speed section and one-time switch from the first version Tested with a fresh stack: full install + demo + hardening, re-run keeps DB/uploads, rebuilt image delivers code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.3 KiB
Docker
28 lines
1.3 KiB
Docker
# Server image: same PHP/Apache as docker/Dockerfile, plus the shop code baked in.
|
|
# On start, server-entrypoint.sh copies the code into the volume at /var/www/html
|
|
# (Linux filesystem). Docker Desktop bind mounts from C:\ are ~40x slower for PHP.
|
|
FROM php:8.3-apache
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
libfreetype6-dev libjpeg62-turbo-dev libpng-dev libwebp-dev \
|
|
libzip-dev libxml2-dev libicu-dev unzip rsync \
|
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
|
|
&& docker-php-ext-install -j"$(nproc)" pdo_mysql mysqli gd zip soap intl opcache \
|
|
&& a2enmod rewrite headers \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY docker/php.ini /usr/local/etc/php/conf.d/qloapps.ini
|
|
COPY docker/php-server.ini /usr/local/etc/php/conf.d/zz-server.ini
|
|
COPY docker/apache-hardening.conf /etc/apache2/conf-enabled/zz-hardening.conf
|
|
RUN sed -ri 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf
|
|
|
|
COPY . /opt/qloapps-src
|
|
COPY docker/server-entrypoint.sh /usr/local/bin/server-entrypoint.sh
|
|
# Windows checkouts may carry CRLF line endings
|
|
RUN sed -i 's/\r$//' /usr/local/bin/server-entrypoint.sh && chmod +x /usr/local/bin/server-entrypoint.sh
|
|
|
|
WORKDIR /var/www/html
|
|
ENTRYPOINT ["server-entrypoint.sh"]
|
|
CMD ["apache2-foreground"]
|