The base Docker image of Zephyrus applications: PHP on Apache, Debian 13 (trixie), built from the official
php:<version>-apache-trixie image. Published as ghcr.io/zephyrus-framework/php.
| Tag | Target | For |
|---|---|---|
8.4, 8.6 |
prod |
the image an application serves |
8.4-dev, 8.6-dev |
dev |
development, test suites, and the build stage of an application image |
Every tag covers amd64 and arm64. dev is built on prod, so the served image is a subset of the one the test
suites run in.
- PHP and Apache from the official image, without its compiler (
$PHPIZE_DEPS). - Extensions built on top of the official ones: APCu, GD (FreeType, JPEG and WebP), exif, gettext, gmp, intl, pcntl, pdo_pgsql, pgsql and zip. mbstring too on 8.6, whose official image no longer compiles it in.
- The Debian packages those extensions need at runtime (found by
lddat build time),ca-certificates,curl,localesandsupervisor. Supervisor has no program: the application brings its own. - PHP is thread-safe (ZTS) on 8.6, like the official
php:8.6-apacheimage since 8.6.0, whose non thread-safe variant exists forclialone. 8.4 stays non thread-safe. Apache keeps the prefork MPM on both. An extension an application compiles on a-devtag (docker-php-ext-install,phpize) is built for the PHP it serves. - On 8.6, APCu is built from a commit of its development branch, pinned in
.github/workflows/build.yml, as no release builds on 8.6 yet. - Apache modules
rewrite,headersandexpires;ssl,statusandautoindexare off. - Apache serves
/var/www/html/publicalone, on port$APACHE_PORT(80 by default). /var/www/htmlbelongs to root (0755), with an emptypublic/.- Locales
en_CA.UTF-8andfr_CA.UTF-8, time zoneAmerica/Montreal. - No setuid or setgid file.
CMD ["apache2-foreground"], port 80. NoUSER: running aswww-datais the application's call (see below).
prod has no compiler, no -dev package, no Composer, no git, no Xdebug, no ssh2, no MailCatcher, no cron, no
wget, no SSH client and no mail server (exim4, sendmail).
Everything in prod, plus:
- Composer, git,
build-essential, phpize's tools, the library headers (-devpackages) and the PHP source archive (/usr/src/php.tar.xz), enough to build another extension on top withdocker-php-ext-installorphpize; - ssh2, loaded;
- Xdebug, compiled but disabled: its ini file waits in
/usr/local/etc/php/disabled/, andphp -d zend_extension=xdebug.soloads it for one command. On 8.6 it is built from a pinned commit of its development branch (3.6.0alpha2-dev); - MailCatcher, with its dependencies at the versions of
Gemfile.lock, and cron (a manualbundle lockpasses--add-checksums, or theCHECKSUMSsection disappears without a word); - Supervisor runs Apache, MailCatcher and cron:
CMD ["/usr/bin/supervisord"], ports 80 and 1080.
A -dev tag is never served: MailCatcher runs as root with no authentication. Publish its ports on the loopback
alone:
docker run --rm -p 127.0.0.1:8080:80 -p 127.0.0.1:1080:1080 -v "$PWD":/var/www/html \
ghcr.io/zephyrus-framework/php:8.4-devPHP, in both targets: custom.ini (errors logged and never displayed, no X-Powered-By, exception
traces without arguments) and php2shell.ini. dev adds dev.ini (traces keep their
arguments) and xdebug.ini, without effect while Xdebug is not loaded. They are installed as
base-*.ini in /usr/local/etc/php/conf.d/, so an application's zz-*.ini there overrides any of them.
Apache, in both targets:
DocumentRoot /var/www/html/public, indefault.confand in the main server, which answers a port no<VirtualHost>claims: nothing abovepublic/is served.ServerName localhost.- A
.htaccessis read inpublic/alone (AllowOverride Noneon/var/www/,docker-php.confincluded). Listen ${APACHE_PORT}inports.confand<VirtualHost *:${APACHE_PORT}>indefault.conf: an image changes the port withENV APACHE_PORT=8080, without editing either file. An application's own vhost is written<VirtualHost *:${APACHE_PORT}>: one left on*:80is ignored without a warning once the port changes, and the main server answers in its place, without the vhost's access rules, headers and log.AllowEncodedSlashes NoDecodesits in every enabled<VirtualHost>, so a%2Fin a path reaches PHP instead of Apache's own 404. It is not inherited from the server configuration: a vhost a downstream image adds needs the line too.ServerTokens ProdandServerSignature Off: theServerheader is plainApache.- No TLS: no
mod_ssl, no 443 vhost, no private key. TLS ends in front of the container. - The files of
ssl,statusandautoindexstay inmods-available, soa2dismodon them returns 0 in a downstream image.
The build and check-image.sh between them fail if any of this stops being true.
Dependencies are installed on 8.4-dev, which has Composer and git; the served image is built on 8.4, which has
neither.
FROM ghcr.io/zephyrus-framework/php:8.4-dev AS vendor
WORKDIR /src
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-interaction --no-progress --prefer-dist
FROM ghcr.io/zephyrus-framework/php:8.4
COPY . /var/www/html
COPY --from=vendor /src/vendor /var/www/html/vendor
RUN find /var/www/html -perm /022 ! -type l -exec chmod go-w {} +
USER www-dataThe code belongs to root and the application runs as www-data: /var/www/html stays root's (0755) through the
COPY and the chmod strips write access a lax build context (a working copy made under umask 000) would carry in,
so www-data can change nothing there, and the application opens only the directories it writes to.
www-data can listen on port 80 because Docker opens the low ports to every user of a container
(net.ipv4.ip_unprivileged_port_start=0). A runtime that does not (one that runs the image as www-data outside
Docker Engine) needs ENV APACHE_PORT=8080 in the image, and its proxy pointed at port 8080. Leave vendor/ out of
the build context with a .dockerignore.
./check-image.sh <image> checks what the prod target carries, as root, through its own entrypoint, and stops at the
first failure: Cmd, Entrypoint, exposed ports, StopSignal, the names of the environment variables, the values of
APACHE_CONFDIR, APACHE_ENVVARS, PHP_INI_DIR, APACHE_PORT and PATH, no ONBUILD, volume, User, Shell or
Healthcheck, no development tool or -dev package, no setuid or setgid file, no file capability, no private key in
/etc, /root, /usr/local or /var, every extension loaded without a warning (and neither Xdebug nor ssh2), the
Apache modules against an allowlist, ServerTokens, ServerSignature and TraceEnable, the main DocumentRoot, the
owner of /var/www/html and public/, the routing as Apache itself parses it (DUMP_CONFIG: no <If> condition, one
virtual host, the DocumentRoot, no Alias beyond /icons/, no Rewrite* directive, no Listen beyond
$APACHE_PORT, log directives that aim at the image's own log files alone, and the stock LogFormat and LogLevel),
the log files linked to /dev/stdout and /dev/stderr, no file name with a control character, no IfFile, IfDefine,
Define or section name built from a variable in an included file, the icons of apache2-data unaltered, Supervisor
without a program, the locales. Apache's configuration is read through apache2-foreground, the launcher the image
runs, over a test application written into a /var/www/html that holds an empty public/ alone. It then asks Apache
itself, on port $APACHE_PORT and on a port no vhost claims, for the PHP version and directives it serves (with no
auto_prepend_file or auto_append_file, and an empty error_log, mail.log and opcache.error_log, which the PHP
CLI keeps empty too), its headers, which .htaccess it reads, /private.txt outside public/ and TRACE, then that
the probes wrote nothing else into /var/www/html.
It needs Docker and nothing else, and prints check-image: PASS at
the end. It catches the regressions it looks for; it is no proof that an image is safe, and it targets this base image,
not an application image built on it: a COPY into public/, USER www-data or APACHE_PORT=8080, which "An
application image" recommends, are refused. The CI runs it on every version and architecture before anything is
published.
The build arguments have no default: prod needs the first two below, dev all four, and the build stops at once when
one is missing (or, for a commit, is not a full SHA). PHP_VERSION is the minor version (8.4), the tag of the
official image to build on. Their values for each PHP version are in the matrix of
.github/workflows/build.yml, the only place they are set.
docker build --target prod \
--build-arg PHP_VERSION=8.4 \
--build-arg APCU_COMMIT=<apcu> \
-t zephyrus-php:8.4 .
./check-image.sh zephyrus-php:8.4
docker build --target dev \
--build-arg PHP_VERSION=8.4 \
--build-arg APCU_COMMIT=<apcu> \
--build-arg SSH2_COMMIT=<ssh2> \
--build-arg XDEBUG_COMMIT=<xdebug> \
-t zephyrus-php:8.4-dev .- A pull request to
mainbuilds both versions on both architectures and runscheck-image.sh; it publishes nothing and writes no cache. - A push to
mainpublishes the four tags. Each version and architecture buildsprod, runscheck-image.sh, buildsdev, and only then pushes both by digest. A version's two tags move only once both of its architectures have passed in that run; the versions are independent, so a failing 8.6 never holds 8.4 back. - Every Monday at 07:00 UTC the images are rebuilt without cache, from a fresh pull of the official image, and
published again: each tag takes the latest PHP patch the official image has released for its minor version, and the
security fixes of Debian and Apache, even when nothing is pushed here. A manual run of
Publishdoes the same. GitHub suspends a scheduled workflow after 60 days without activity in a public repository: turn it back on in the Actions tab if that happens. - An application takes these fixes when it builds with a fresh pull (
docker build --pull). - The
cache-*tags are the build cache of the CI, not images to pull.
| Before | After |
|---|---|
ghcr.io/ophelios-studio/docker-pulsar-php84:latest, for a development image or a build stage |
ghcr.io/zephyrus-framework/php:8.4-dev |
ghcr.io/ophelios-studio/docker-pulsar-php84:latest, for the stage that is served |
ghcr.io/zephyrus-framework/php:8.4 |
ghcr.io/ophelios-studio/docker-pulsar-php86:latest |
8.6-dev and 8.6, the same way |
What changes for an image built on top:
000-default.conf(DocumentRoot/var/www/html) is disabled. Its file stays insites-available, soa2dissite 000-default.confstill returns 0.default.conf(DocumentRoot/var/www/html/public) is now a site ofsites-available, enabled witha2ensite default: an application with its own vhost turns it off witha2dissite default.- No setuid or setgid file (
su,passwd,mount,crontab...). Installing a package in a derived image can bring some back. /var/www/htmlbelongs to root (0755) in both targets: an application image no longer needs its ownchownandchmod.- A
.htaccessabovepublic/is no longer read. - The base sets the PHP error directives each application used to set itself (
custom.ini): its ownzz-*.inican drop them, and still overrides the base.-devdisplays no error either (the old image had nophp.ini, sodisplay_errorswas on), and keeps the arguments in exception traces. - A different port is
ENV APACHE_PORT=<port>, not an edit ofports.confand the vhost, and an application's own vhost is written<VirtualHost *:${APACHE_PORT}>: one left on*:80is ignored without a warning once the port changes, and the main server answers in its place. autoindexis off: a directory without an index answers 404 instead of listing its files.- The
en_CA.UTF-8andfr_CA.UTF-8locales are really generated (the old images generated none). - GD reads and writes WebP and pcntl is loaded, in both targets: a derived image no longer rebuilds gd or adds pcntl.
8.4and8.6runapache2-foregroundalone, on port 80: no Supervisor program, no MailCatcher, no cron. Those stay in the-devtags.- No per-architecture tag: each tag covers amd64 and arm64.
The tags 8.4, 8.4-dev, 8.6 and 8.6-dev moved from Debian 12 (bookworm) to Debian 13 (trixie). An application
picks the change up at its next build on the same tags (docker build --pull). What changes:
- glibc 2.41 instead of 2.36, ICU 76 instead of 72, OpenSSL 3.5 instead of 3.0, and Ruby 3.3 instead of 3.1 in
-dev. - Locale data follows ICU 76. Run the application's formatting tests. Time zone names in the
FULLandLONGdate styles change for some zones: inAmerica/Montreal,UTC−04:00becomesheure avancée de l’Est(fr_CA) andGMT-4becomesEDT(en_CA), whileAmerica/TorontoandUTCdo not change. TheSHORTstyle ofen_CAbecomes2026-03-07, andlocaleconv()reports amon_groupingof[3]instead of[3,3]. Number formats and theCollatororder are unchanged. pdo_pgsqlandpgsqllinklibpq17 (bookworm: 15). Debian 13 shipspostgresql-17and its client: a derived image installs them without the PGDG repository.- MailCatcher is 0.11.0, installed with
bundle3.3. - Some
aptpackages were renamed. A derived image that installs one of the old names fails to build:
| Bookworm | Trixie |
|---|---|
libcurl4 |
libcurl4t64 |
libssh2-1 |
libssh2-1t64 |
libfreetype6-dev |
libfreetype-dev |
rubygems |
ruby-rubygems (installed with ruby-dev), and bundler for the bundle command |
To stay on Debian 12, pin the digest of the bookworm image in the FROM line, for example
ghcr.io/zephyrus-framework/php:8.4@sha256:...:
| Tag | Bookworm digest |
|---|---|
8.4 |
sha256:acfbe0dcad654baec96bf0dbfddd70dc9aa3563e2d838e4681a631de2cf59a4b |
8.4-dev |
sha256:4bd0b1e4acb246ac111b7bc1f653f77194b3dbd4877ab4551af1f47124e4c99d |
8.6 |
sha256:15abcdfe719275caf35caacc2a1492a28b1c647935e713ec4ada181764b8d3ad |
8.6-dev |
sha256:882671019bab875d2e2ae0bf6a15b9a4726fe1d42f3e0db4e5d6ea5cb704731b |
A pinned digest gets no further Debian or PHP security fix: use it as a short stop while the application is fixed, not as a place to stay.
MIT, see LICENSE.