diff --git a/php/8.2/frankenphp/Dockerfile b/php/8.2/frankenphp/Dockerfile index 0a6ef4f..6242ebc 100644 --- a/php/8.2/frankenphp/Dockerfile +++ b/php/8.2/frankenphp/Dockerfile @@ -1,96 +1,9 @@ -ARG FRANKENPHP_VERSION=1.13.1 +ARG FRANKENPHP_VERSION=1.13.2 ARG PHP_VERSION=8.2 -# PHP security release to rebuild over the upstream image's PHP, for when -# upstream (php:*-zts-alpine -> dunglas/frankenphp) lags a php.net release. -# Hash from https://www.php.net/releases/index.php?json&version=8.2. -# Once the FROM image ships this version or newer (the php-patched stage -# then fails the build), remove the php-patched stage, these PHP_PATCH_* -# ARGs, and the ARG/COPY/ENV block after LABEL in the final stage. -ARG PHP_PATCH_VERSION=8.2.35 -ARG PHP_PATCH_SHA256=5737b98601fe5ab1b8c5db0c82ed3158acb9283ed3081ffe2faffb9ac81455e6 - -# Rebuilds PHP from the patched tarball using the upstream image's own -# configure flags (read back from php-config) and the docker-library build -# recipe, then stages `make install` into /php-install. FrankenPHP links -# libphp.so dynamically and a patch release keeps the same API numbers, so -# swapping libphp.so, the binaries and the shared extensions is enough. -FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine AS php-patched -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -RUN set -eux; \ - # Copying this build over a base that already has the same or a newer - # PHP would silently downgrade it. - php -r 'exit(version_compare(PHP_VERSION, getenv("PHP_PATCH_VERSION"), "<") ? 0 : 1);' || \ - { echo "ERROR: base already ships PHP $(php -r 'echo PHP_VERSION;'); remove the php-patched stage" >&2; exit 1; }; \ - \ - # 8.4+ record PHP_UNAME='Linux - Docker' unquoted; drop it so the word - # split at ./configure doesn't break it apart (it's re-added there). - configure_opts="$(php-config --configure-options | sed 's/ PHP_UNAME=Linux - Docker//')"; \ - case "$configure_opts" in *PHP_UNAME=*) \ - echo "ERROR: unexpected PHP_UNAME in configure options: $configure_opts" >&2; exit 1;; \ - esac; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - patch \ - patchutils \ - readline-dev \ - sqlite-dev; \ - # make sure musl's iconv doesn't get used (matches docker-library) - rm -vf /usr/include/iconv.h; \ - \ - mkdir -p /php-install/usr/src "/php-install$PHP_INI_DIR"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz.asc "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc"; \ - echo "${PHP_PATCH_SHA256} */php-install/usr/src/php.tar.xz" | sha256sum -c -; \ - mkdir /usr/src/php; \ - tar -Jxf /php-install/usr/src/php.tar.xz -C /usr/src/php --strip-components=1; \ - cd /usr/src/php; \ - # 8.2's JIT fails to assemble on Alpine 3.22+ binutils without this - # (same patch docker-library applies to its 8.2 alpine images): - # https://github.com/php/php-src/issues/18743 - curl -fL 'https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1' -o 18743.patch; \ - echo 'b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5 *18743.patch' | sha256sum -c -; \ - filterdiff -x '*/NEWS' 18743.patch | patch -p1; \ - rm 18743.patch; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - PHP_BUILD_PROVIDER='https://github.com/docker-library/php'; \ - # word splitting of configure_opts is intended - ./configure $configure_opts PHP_UNAME='Linux - Docker'; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install INSTALL_ROOT=/php-install; \ - find /php-install/usr/local -type f -perm '/0111' \ - -exec sh -euxc 'strip --strip-all "$@" || :' -- '{}' +; \ - cp -v php.ini-* "/php-install$PHP_INI_DIR/"; \ - \ - test "$(/php-install/usr/local/bin/php -n -r 'echo PHP_VERSION;')" = "$PHP_PATCH_VERSION" - FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine LABEL maintainer="Michael Aguiar " -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -# Only usr/: PEAR's installer also drops registry dotfiles at INSTALL_ROOT. -COPY --from=php-patched /php-install/usr/ /usr/ -ENV PHP_VERSION=${PHP_PATCH_VERSION} \ - PHP_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz \ - PHP_ASC_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc \ - PHP_SHA256=${PHP_PATCH_SHA256} - # Runtime UID. Keep this DIFFERENT from the UID that owns the bind-mounted # source on the host: if they match, PHP owns every file it serves and any # code-execution bug becomes persistent code modification. Downstream images @@ -126,9 +39,9 @@ ENV PHP_MEMORY_LIMIT=256M \ MSMTP_RELAY_SERVER_TLS=off \ MSMTP_RELAY_SERVER_FROM=no-reply@localhost - # Fail the build rather than ship the vulnerable PHP if the patched - # libphp/binaries didn't land over the upstream ones. `frankenphp - # php-cli` runs the libphp.so the server embeds; `php` is its own binary. +# Fail the build if the PHP the server embeds doesn't match the image's +# PHP_VERSION. `frankenphp php-cli` runs the libphp.so the server embeds; +# `php` is its own binary. RUN for bin in "frankenphp php-cli" php; do \ v="$($bin -r 'echo PHP_VERSION;')"; \ test "$v" = "$PHP_VERSION" || { echo "ERROR: $bin reports $v, expected $PHP_VERSION" >&2; exit 1; }; \ diff --git a/php/8.3/frankenphp/Dockerfile b/php/8.3/frankenphp/Dockerfile index 77d10f6..578c9af 100644 --- a/php/8.3/frankenphp/Dockerfile +++ b/php/8.3/frankenphp/Dockerfile @@ -1,87 +1,9 @@ -ARG FRANKENPHP_VERSION=1.13.1 +ARG FRANKENPHP_VERSION=1.13.2 ARG PHP_VERSION=8.3 -# PHP security release to rebuild over the upstream image's PHP, for when -# upstream (php:*-zts-alpine -> dunglas/frankenphp) lags a php.net release. -# Hash from https://www.php.net/releases/index.php?json&version=8.3. -# Once the FROM image ships this version or newer (the php-patched stage -# then fails the build), remove the php-patched stage, these PHP_PATCH_* -# ARGs, and the ARG/COPY/ENV block after LABEL in the final stage. -ARG PHP_PATCH_VERSION=8.3.36 -ARG PHP_PATCH_SHA256=dd54693aa334c5c4d72e9aee96b082c2473750a18a6c1d105789c93a3b1692fd - -# Rebuilds PHP from the patched tarball using the upstream image's own -# configure flags (read back from php-config) and the docker-library build -# recipe, then stages `make install` into /php-install. FrankenPHP links -# libphp.so dynamically and a patch release keeps the same API numbers, so -# swapping libphp.so, the binaries and the shared extensions is enough. -FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine AS php-patched -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -RUN set -eux; \ - # Copying this build over a base that already has the same or a newer - # PHP would silently downgrade it. - php -r 'exit(version_compare(PHP_VERSION, getenv("PHP_PATCH_VERSION"), "<") ? 0 : 1);' || \ - { echo "ERROR: base already ships PHP $(php -r 'echo PHP_VERSION;'); remove the php-patched stage" >&2; exit 1; }; \ - \ - # 8.4+ record PHP_UNAME='Linux - Docker' unquoted; drop it so the word - # split at ./configure doesn't break it apart (it's re-added there). - configure_opts="$(php-config --configure-options | sed 's/ PHP_UNAME=Linux - Docker//')"; \ - case "$configure_opts" in *PHP_UNAME=*) \ - echo "ERROR: unexpected PHP_UNAME in configure options: $configure_opts" >&2; exit 1;; \ - esac; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev; \ - # make sure musl's iconv doesn't get used (matches docker-library) - rm -vf /usr/include/iconv.h; \ - \ - mkdir -p /php-install/usr/src "/php-install$PHP_INI_DIR"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz.asc "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc"; \ - echo "${PHP_PATCH_SHA256} */php-install/usr/src/php.tar.xz" | sha256sum -c -; \ - mkdir /usr/src/php; \ - tar -Jxf /php-install/usr/src/php.tar.xz -C /usr/src/php --strip-components=1; \ - cd /usr/src/php; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - PHP_BUILD_PROVIDER='https://github.com/docker-library/php'; \ - # word splitting of configure_opts is intended - ./configure $configure_opts PHP_UNAME='Linux - Docker'; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install INSTALL_ROOT=/php-install; \ - find /php-install/usr/local -type f -perm '/0111' \ - -exec sh -euxc 'strip --strip-all "$@" || :' -- '{}' +; \ - cp -v php.ini-* "/php-install$PHP_INI_DIR/"; \ - \ - test "$(/php-install/usr/local/bin/php -n -r 'echo PHP_VERSION;')" = "$PHP_PATCH_VERSION" - FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine LABEL maintainer="Michael Aguiar " -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -# Only usr/: PEAR's installer also drops registry dotfiles at INSTALL_ROOT. -COPY --from=php-patched /php-install/usr/ /usr/ -ENV PHP_VERSION=${PHP_PATCH_VERSION} \ - PHP_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz \ - PHP_ASC_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc \ - PHP_SHA256=${PHP_PATCH_SHA256} - # Runtime UID. Keep this DIFFERENT from the UID that owns the bind-mounted # source on the host: if they match, PHP owns every file it serves and any # code-execution bug becomes persistent code modification. Downstream images @@ -117,9 +39,9 @@ ENV PHP_MEMORY_LIMIT=256M \ MSMTP_RELAY_SERVER_TLS=off \ MSMTP_RELAY_SERVER_FROM=no-reply@localhost - # Fail the build rather than ship the vulnerable PHP if the patched - # libphp/binaries didn't land over the upstream ones. `frankenphp - # php-cli` runs the libphp.so the server embeds; `php` is its own binary. +# Fail the build if the PHP the server embeds doesn't match the image's +# PHP_VERSION. `frankenphp php-cli` runs the libphp.so the server embeds; +# `php` is its own binary. RUN for bin in "frankenphp php-cli" php; do \ v="$($bin -r 'echo PHP_VERSION;')"; \ test "$v" = "$PHP_VERSION" || { echo "ERROR: $bin reports $v, expected $PHP_VERSION" >&2; exit 1; }; \ diff --git a/php/8.4/frankenphp/Dockerfile b/php/8.4/frankenphp/Dockerfile index dc60407..f844453 100644 --- a/php/8.4/frankenphp/Dockerfile +++ b/php/8.4/frankenphp/Dockerfile @@ -1,87 +1,9 @@ -ARG FRANKENPHP_VERSION=1.13.1 +ARG FRANKENPHP_VERSION=1.13.2 ARG PHP_VERSION=8.4 -# PHP security release to rebuild over the upstream image's PHP, for when -# upstream (php:*-zts-alpine -> dunglas/frankenphp) lags a php.net release. -# Hash from https://www.php.net/releases/index.php?json&version=8.4. -# Once the FROM image ships this version or newer (the php-patched stage -# then fails the build), remove the php-patched stage, these PHP_PATCH_* -# ARGs, and the ARG/COPY/ENV block after LABEL in the final stage. -ARG PHP_PATCH_VERSION=8.4.27 -ARG PHP_PATCH_SHA256=dcf93923b0e38e0d5252b25b796520b5a47761a08b3488b6d0b5d1115764d3f0 - -# Rebuilds PHP from the patched tarball using the upstream image's own -# configure flags (read back from php-config) and the docker-library build -# recipe, then stages `make install` into /php-install. FrankenPHP links -# libphp.so dynamically and a patch release keeps the same API numbers, so -# swapping libphp.so, the binaries and the shared extensions is enough. -FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine AS php-patched -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -RUN set -eux; \ - # Copying this build over a base that already has the same or a newer - # PHP would silently downgrade it. - php -r 'exit(version_compare(PHP_VERSION, getenv("PHP_PATCH_VERSION"), "<") ? 0 : 1);' || \ - { echo "ERROR: base already ships PHP $(php -r 'echo PHP_VERSION;'); remove the php-patched stage" >&2; exit 1; }; \ - \ - # 8.4+ record PHP_UNAME='Linux - Docker' unquoted; drop it so the word - # split at ./configure doesn't break it apart (it's re-added there). - configure_opts="$(php-config --configure-options | sed 's/ PHP_UNAME=Linux - Docker//')"; \ - case "$configure_opts" in *PHP_UNAME=*) \ - echo "ERROR: unexpected PHP_UNAME in configure options: $configure_opts" >&2; exit 1;; \ - esac; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev; \ - # make sure musl's iconv doesn't get used (matches docker-library) - rm -vf /usr/include/iconv.h; \ - \ - mkdir -p /php-install/usr/src "/php-install$PHP_INI_DIR"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz.asc "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc"; \ - echo "${PHP_PATCH_SHA256} */php-install/usr/src/php.tar.xz" | sha256sum -c -; \ - mkdir /usr/src/php; \ - tar -Jxf /php-install/usr/src/php.tar.xz -C /usr/src/php --strip-components=1; \ - cd /usr/src/php; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - PHP_BUILD_PROVIDER='https://github.com/docker-library/php'; \ - # word splitting of configure_opts is intended - ./configure $configure_opts PHP_UNAME='Linux - Docker'; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install INSTALL_ROOT=/php-install; \ - find /php-install/usr/local -type f -perm '/0111' \ - -exec sh -euxc 'strip --strip-all "$@" || :' -- '{}' +; \ - cp -v php.ini-* "/php-install$PHP_INI_DIR/"; \ - \ - test "$(/php-install/usr/local/bin/php -n -r 'echo PHP_VERSION;')" = "$PHP_PATCH_VERSION" - FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine LABEL maintainer="Michael Aguiar " -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -# Only usr/: PEAR's installer also drops registry dotfiles at INSTALL_ROOT. -COPY --from=php-patched /php-install/usr/ /usr/ -ENV PHP_VERSION=${PHP_PATCH_VERSION} \ - PHP_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz \ - PHP_ASC_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc \ - PHP_SHA256=${PHP_PATCH_SHA256} - # Runtime UID. Keep this DIFFERENT from the UID that owns the bind-mounted # source on the host: if they match, PHP owns every file it serves and any # code-execution bug becomes persistent code modification. Downstream images @@ -117,9 +39,9 @@ ENV PHP_MEMORY_LIMIT=256M \ MSMTP_RELAY_SERVER_TLS=off \ MSMTP_RELAY_SERVER_FROM=no-reply@localhost - # Fail the build rather than ship the vulnerable PHP if the patched - # libphp/binaries didn't land over the upstream ones. `frankenphp - # php-cli` runs the libphp.so the server embeds; `php` is its own binary. +# Fail the build if the PHP the server embeds doesn't match the image's +# PHP_VERSION. `frankenphp php-cli` runs the libphp.so the server embeds; +# `php` is its own binary. RUN for bin in "frankenphp php-cli" php; do \ v="$($bin -r 'echo PHP_VERSION;')"; \ test "$v" = "$PHP_VERSION" || { echo "ERROR: $bin reports $v, expected $PHP_VERSION" >&2; exit 1; }; \ diff --git a/php/8.5/frankenphp/Dockerfile b/php/8.5/frankenphp/Dockerfile index 4dc80ac..3438d80 100644 --- a/php/8.5/frankenphp/Dockerfile +++ b/php/8.5/frankenphp/Dockerfile @@ -1,87 +1,9 @@ -ARG FRANKENPHP_VERSION=1.13.1 +ARG FRANKENPHP_VERSION=1.13.2 ARG PHP_VERSION=8.5 -# PHP security release to rebuild over the upstream image's PHP, for when -# upstream (php:*-zts-alpine -> dunglas/frankenphp) lags a php.net release. -# Hash from https://www.php.net/releases/index.php?json&version=8.5. -# Once the FROM image ships this version or newer (the php-patched stage -# then fails the build), remove the php-patched stage, these PHP_PATCH_* -# ARGs, and the ARG/COPY/ENV block after LABEL in the final stage. -ARG PHP_PATCH_VERSION=8.5.12 -ARG PHP_PATCH_SHA256=08bc2eba2a588654ade1357174aa646b761556c862dda0678345ee29ed481209 - -# Rebuilds PHP from the patched tarball using the upstream image's own -# configure flags (read back from php-config) and the docker-library build -# recipe, then stages `make install` into /php-install. FrankenPHP links -# libphp.so dynamically and a patch release keeps the same API numbers, so -# swapping libphp.so, the binaries and the shared extensions is enough. -FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine AS php-patched -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -RUN set -eux; \ - # Copying this build over a base that already has the same or a newer - # PHP would silently downgrade it. - php -r 'exit(version_compare(PHP_VERSION, getenv("PHP_PATCH_VERSION"), "<") ? 0 : 1);' || \ - { echo "ERROR: base already ships PHP $(php -r 'echo PHP_VERSION;'); remove the php-patched stage" >&2; exit 1; }; \ - \ - # 8.4+ record PHP_UNAME='Linux - Docker' unquoted; drop it so the word - # split at ./configure doesn't break it apart (it's re-added there). - configure_opts="$(php-config --configure-options | sed 's/ PHP_UNAME=Linux - Docker//')"; \ - case "$configure_opts" in *PHP_UNAME=*) \ - echo "ERROR: unexpected PHP_UNAME in configure options: $configure_opts" >&2; exit 1;; \ - esac; \ - apk add --no-cache --virtual .build-deps \ - $PHPIZE_DEPS \ - argon2-dev \ - coreutils \ - curl-dev \ - gnu-libiconv-dev \ - libsodium-dev \ - libxml2-dev \ - linux-headers \ - oniguruma-dev \ - openssl-dev \ - readline-dev \ - sqlite-dev; \ - # make sure musl's iconv doesn't get used (matches docker-library) - rm -vf /usr/include/iconv.h; \ - \ - mkdir -p /php-install/usr/src "/php-install$PHP_INI_DIR"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz"; \ - curl -fsSL -o /php-install/usr/src/php.tar.xz.asc "https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc"; \ - echo "${PHP_PATCH_SHA256} */php-install/usr/src/php.tar.xz" | sha256sum -c -; \ - mkdir /usr/src/php; \ - tar -Jxf /php-install/usr/src/php.tar.xz -C /usr/src/php --strip-components=1; \ - cd /usr/src/php; \ - \ - export \ - CFLAGS="$PHP_CFLAGS" \ - CPPFLAGS="$PHP_CPPFLAGS" \ - LDFLAGS="$PHP_LDFLAGS" \ - PHP_BUILD_PROVIDER='https://github.com/docker-library/php'; \ - # word splitting of configure_opts is intended - ./configure $configure_opts PHP_UNAME='Linux - Docker'; \ - make -j "$(nproc)"; \ - find -type f -name '*.a' -delete; \ - make install INSTALL_ROOT=/php-install; \ - find /php-install/usr/local -type f -perm '/0111' \ - -exec sh -euxc 'strip --strip-all "$@" || :' -- '{}' +; \ - cp -v php.ini-* "/php-install$PHP_INI_DIR/"; \ - \ - test "$(/php-install/usr/local/bin/php -n -r 'echo PHP_VERSION;')" = "$PHP_PATCH_VERSION" - FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-alpine LABEL maintainer="Michael Aguiar " -ARG PHP_PATCH_VERSION -ARG PHP_PATCH_SHA256 -# Only usr/: PEAR's installer also drops registry dotfiles at INSTALL_ROOT. -COPY --from=php-patched /php-install/usr/ /usr/ -ENV PHP_VERSION=${PHP_PATCH_VERSION} \ - PHP_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz \ - PHP_ASC_URL=https://www.php.net/distributions/php-${PHP_PATCH_VERSION}.tar.xz.asc \ - PHP_SHA256=${PHP_PATCH_SHA256} - # Runtime UID. Keep this DIFFERENT from the UID that owns the bind-mounted # source on the host: if they match, PHP owns every file it serves and any # code-execution bug becomes persistent code modification. Downstream images @@ -117,9 +39,9 @@ ENV PHP_MEMORY_LIMIT=256M \ MSMTP_RELAY_SERVER_TLS=off \ MSMTP_RELAY_SERVER_FROM=no-reply@localhost - # Fail the build rather than ship the vulnerable PHP if the patched - # libphp/binaries didn't land over the upstream ones. `frankenphp - # php-cli` runs the libphp.so the server embeds; `php` is its own binary. +# Fail the build if the PHP the server embeds doesn't match the image's +# PHP_VERSION. `frankenphp php-cli` runs the libphp.so the server embeds; +# `php` is its own binary. RUN for bin in "frankenphp php-cli" php; do \ v="$($bin -r 'echo PHP_VERSION;')"; \ test "$v" = "$PHP_VERSION" || { echo "ERROR: $bin reports $v, expected $PHP_VERSION" >&2; exit 1; }; \