From c26d1c28de1289d14e0a01887421f204765455dc Mon Sep 17 00:00:00 2001 From: bfren Date: Fri, 12 Sep 2025 12:59:08 +0100 Subject: [PATCH 1/5] Bumping version to 7.4.5 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c74107f..431b4a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.4.4 \ No newline at end of file +7.4.5 \ No newline at end of file From 7b853f479d5410e7be6173adfd4bf914f16781b3 Mon Sep 17 00:00:00 2001 From: bfren Date: Fri, 12 Sep 2025 12:59:38 +0100 Subject: [PATCH 2/5] Using latest base images --- 7.4/Dockerfile | 4 ++-- 8.0/Dockerfile | 4 ++-- 8.1/Dockerfile | 4 ++-- 8.2/Dockerfile | 4 ++-- 8.3/Dockerfile | 4 ++-- 8.4/Dockerfile | 4 ++-- generate-dockerfiles.sh | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/7.4/Dockerfile b/7.4/Dockerfile index f6ddf91..3742db9 100644 --- a/7.4/Dockerfile +++ b/7.4/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /tmp RUN \ # get the Nu scripts from the PHP image overlay echo "Cloning Alpine overlay." && \ - apk add git && git clone --branch v2.4.4 https://github.com/bfren/docker-php.git && \ + apk add git && git clone --branch v2.4.5 https://github.com/bfren/docker-php.git && \ mkdir /overlay && \ mv docker-php/overlay/etc /overlay/ @@ -17,7 +17,7 @@ RUN \ # STAGE 1: create final image #====================================================================================================================== -FROM ghcr.io/bfren/nginx:nginx1.20-alpine3.15-6.5.5 AS final +FROM ghcr.io/bfren/nginx:nginx1.20-alpine3.15-6.5.6 AS final COPY --from=php /overlay / LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-php" diff --git a/8.0/Dockerfile b/8.0/Dockerfile index cfff7fe..b212003 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /tmp RUN \ # get the Nu scripts from the PHP image overlay echo "Cloning Alpine overlay." && \ - apk add git && git clone --branch v2.4.4 https://github.com/bfren/docker-php.git && \ + apk add git && git clone --branch v2.4.5 https://github.com/bfren/docker-php.git && \ mkdir /overlay && \ mv docker-php/overlay/etc /overlay/ @@ -17,7 +17,7 @@ RUN \ # STAGE 1: create final image #====================================================================================================================== -FROM ghcr.io/bfren/nginx:nginx1.22-alpine3.16-6.5.5 AS final +FROM ghcr.io/bfren/nginx:nginx1.22-alpine3.16-6.5.6 AS final COPY --from=php /overlay / LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-php" diff --git a/8.1/Dockerfile b/8.1/Dockerfile index 08ded61..6345822 100644 --- a/8.1/Dockerfile +++ b/8.1/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /tmp RUN \ # get the Nu scripts from the PHP image overlay echo "Cloning Alpine overlay." && \ - apk add git && git clone --branch v2.4.4 https://github.com/bfren/docker-php.git && \ + apk add git && git clone --branch v2.4.5 https://github.com/bfren/docker-php.git && \ mkdir /overlay && \ mv docker-php/overlay/etc /overlay/ @@ -17,7 +17,7 @@ RUN \ # STAGE 1: create final image #====================================================================================================================== -FROM ghcr.io/bfren/nginx:nginx1.24-alpine3.19-6.5.5 AS final +FROM ghcr.io/bfren/nginx:nginx1.24-alpine3.19-6.5.6 AS final COPY --from=php /overlay / LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-php" diff --git a/8.2/Dockerfile b/8.2/Dockerfile index 2085321..919a73e 100644 --- a/8.2/Dockerfile +++ b/8.2/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /tmp RUN \ # get the Nu scripts from the PHP image overlay echo "Cloning Alpine overlay." && \ - apk add git && git clone --branch v2.4.4 https://github.com/bfren/docker-php.git && \ + apk add git && git clone --branch v2.4.5 https://github.com/bfren/docker-php.git && \ mkdir /overlay && \ mv docker-php/overlay/etc /overlay/ @@ -17,7 +17,7 @@ RUN \ # STAGE 1: create final image #====================================================================================================================== -FROM ghcr.io/bfren/nginx:nginx1.28-alpine3.22-6.5.5 AS final +FROM ghcr.io/bfren/nginx:nginx1.28-alpine3.22-6.5.6 AS final COPY --from=php /overlay / LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-php" diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 0ac0972..2941c8f 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /tmp RUN \ # get the Nu scripts from the PHP image overlay echo "Cloning Alpine overlay." && \ - apk add git && git clone --branch v2.4.4 https://github.com/bfren/docker-php.git && \ + apk add git && git clone --branch v2.4.5 https://github.com/bfren/docker-php.git && \ mkdir /overlay && \ mv docker-php/overlay/etc /overlay/ @@ -17,7 +17,7 @@ RUN \ # STAGE 1: create final image #====================================================================================================================== -FROM ghcr.io/bfren/nginx:nginx1.28-alpine3.22-6.5.5 AS final +FROM ghcr.io/bfren/nginx:nginx1.28-alpine3.22-6.5.6 AS final COPY --from=php /overlay / LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-php" diff --git a/8.4/Dockerfile b/8.4/Dockerfile index c8b7437..bafc4a9 100644 --- a/8.4/Dockerfile +++ b/8.4/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /tmp RUN \ # get the Nu scripts from the PHP image overlay echo "Cloning Alpine overlay." && \ - apk add git && git clone --branch v2.4.4 https://github.com/bfren/docker-php.git && \ + apk add git && git clone --branch v2.4.5 https://github.com/bfren/docker-php.git && \ mkdir /overlay && \ mv docker-php/overlay/etc /overlay/ @@ -17,7 +17,7 @@ RUN \ # STAGE 1: create final image #====================================================================================================================== -FROM ghcr.io/bfren/nginx:nginx1.28-alpine3.22-6.5.5 AS final +FROM ghcr.io/bfren/nginx:nginx1.28-alpine3.22-6.5.6 AS final COPY --from=php /overlay / LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-php" diff --git a/generate-dockerfiles.sh b/generate-dockerfiles.sh index e9c0a58..9a11503 100755 --- a/generate-dockerfiles.sh +++ b/generate-dockerfiles.sh @@ -4,8 +4,8 @@ set -euo pipefail docker pull bfren/alpine -BASE_VERSION="6.5.5" -PHP_BRANCH="v2.4.4" +BASE_VERSION="6.5.6" +PHP_BRANCH="v2.4.5" PHP_VERSIONS="7.4 8.0 8.1 8.2 8.3 8.4" for V in ${PHP_VERSIONS} ; do From f49e37da75b68e72ca98d464076d01dad412f021 Mon Sep 17 00:00:00 2001 From: bfren Date: Fri, 12 Sep 2025 13:18:13 +0100 Subject: [PATCH 3/5] Bumping version to 7.5.0 --- VERSION | 2 +- VERSION_MINOR | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 431b4a5..a2931d3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.4.5 \ No newline at end of file +7.5.0 \ No newline at end of file diff --git a/VERSION_MINOR b/VERSION_MINOR index 9904c66..7290605 100644 --- a/VERSION_MINOR +++ b/VERSION_MINOR @@ -1 +1 @@ -7.4 \ No newline at end of file +7.5 \ No newline at end of file From 53223b2c6e74e566dbd038f1dcd31ea7831dbe03 Mon Sep 17 00:00:00 2001 From: bfren Date: Fri, 12 Sep 2025 13:19:41 +0100 Subject: [PATCH 4/5] Changing the way PHP ini / conf values are overridden to provide more flexibility for individual versions and child images --- README.md | 2 +- overlay/etc/bf/init.d/20-env.nu | 8 ++++---- overlay/etc/bf/init.d/22-php-ini.nu | 14 +++++++------- overlay/etc/bf/init.d/23-www-conf.nu | 16 ++++++++-------- .../bf/php-fpm.d/00-www-conf.json} | 0 .../bf/php.d/00-php-ini.json} | 0 6 files changed, 20 insertions(+), 20 deletions(-) rename overlay/{www-conf.json => etc/bf/php-fpm.d/00-www-conf.json} (100%) rename overlay/{php-ini.json => etc/bf/php.d/00-php-ini.json} (100%) diff --git a/README.md b/README.md index 77e177e..37786c3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Nginx plus PHP (7.4, 8.0, 8.1, 8.2 and 8.3) - no SSL support etc, designed to be * `php-fpm` * `php-session` -Nginx is setup by default to run PHP in FPM mode. To override values in www.conf map a `www-conf.json` file to root - see `www-conf-sample.json`. Values in the php.ini file can be overridden in the same way - see [Docker PHP](https://github.com/bfren/docker-php) for more information and a sample file. +Nginx is setup by default to run PHP in FPM mode. To override values in www.conf map a `xx.json` file to `/etc/bf/php-fpm.d` - see `www-conf-sample.json`. Values in the php.ini file can be overridden in the same way - see [Docker PHP](https://github.com/bfren/docker-php) for more information and a sample file. ## Contents diff --git a/overlay/etc/bf/init.d/20-env.nu b/overlay/etc/bf/init.d/20-env.nu index 72e284f..519751b 100644 --- a/overlay/etc/bf/init.d/20-env.nu +++ b/overlay/etc/bf/init.d/20-env.nu @@ -3,10 +3,10 @@ bf env load # Set environment variables def main [] { - let ini_override = "/php-ini.json" - let fpm_override = "/www-conf.json" - bf env set PHP_INI_OVERRIDE $ini_override - bf env set PHP_FPM_OVERRIDE $fpm_override + let ini_override = $"(bf env ETC)/php.d" + let fpm_override = $"(bf env ETC)/php-fpm.d" + bf env set PHP_INI_OVERRIDE_D $ini_override + bf env set PHP_FPM_OVERRIDE_D $fpm_override let fpm_d = $"(bf env PHP_DIR)/php-fpm.d" bf env set PHP_FPM_D $fpm_d diff --git a/overlay/etc/bf/init.d/22-php-ini.nu b/overlay/etc/bf/init.d/22-php-ini.nu index 2a55b70..80daf96 100644 --- a/overlay/etc/bf/init.d/22-php-ini.nu +++ b/overlay/etc/bf/init.d/22-php-ini.nu @@ -2,12 +2,12 @@ use bf use bf-php bf env load -# Download and setup php.ini +# Apply any overrides to php.ini export def main [] { - # if there is an override file, use it - otherwise use defaults - let override_file = bf env PHP_INI_OVERRIDE - let override_values = if ($override_file | path exists) { bf fs read $override_file | from json } - - # download php.ini file and apply override values - bf-php ini $override_values + # load any override files and apply them + let ini_override = bf env PHP_INI_OVERRIDE_D + if ($ini_override | path exists) { $"($ini_override)/*.json" | into glob | ls --full-paths $in | get name | sort | each {|x| + let override_values = bf fs read $x | from json + bf-php ini $override_values + } } } diff --git a/overlay/etc/bf/init.d/23-www-conf.nu b/overlay/etc/bf/init.d/23-www-conf.nu index 1d67209..340e2a7 100644 --- a/overlay/etc/bf/init.d/23-www-conf.nu +++ b/overlay/etc/bf/init.d/23-www-conf.nu @@ -2,15 +2,15 @@ use bf use bf-php bf env load -# Setup www.conf +# Apply any overrides to www.conf export def main [] { - # set user / group to www + # PHP-FPM configuration file let fpm_conf = bf env PHP_FPM_CONF - let www = "www" - bf-php ini insert_or_replace_values_in_file $fpm_conf {user: $www, group: $www} - # if there is an override file, use it - let override_file = bf env PHP_FPM_OVERRIDE - let override_values = if ($override_file | path exists) { bf fs read $override_file | from json } - bf-php ini insert_or_replace_values_in_file $fpm_conf $override_values + # load any override files and apply them + let fpm_override = bf env PHP_FPM_OVERRIDE_D + if ($fpm_override | path exists) { $"($fpm_override)/*.json" | into glob | ls --full-paths $in | get name | sort | each {|x| + let override_values = bf fs read $x | from json + bf-php ini insert_or_replace_values_in_file $fpm_conf $override_values + } } } diff --git a/overlay/www-conf.json b/overlay/etc/bf/php-fpm.d/00-www-conf.json similarity index 100% rename from overlay/www-conf.json rename to overlay/etc/bf/php-fpm.d/00-www-conf.json diff --git a/overlay/php-ini.json b/overlay/etc/bf/php.d/00-php-ini.json similarity index 100% rename from overlay/php-ini.json rename to overlay/etc/bf/php.d/00-php-ini.json From 0c153ec42a8575cd7d2de227fa1449f116e80bba Mon Sep 17 00:00:00 2001 From: bfren Date: Fri, 12 Sep 2025 13:30:56 +0100 Subject: [PATCH 5/5] Adding opcache and jit support --- overlay/etc/bf/php.d/00-php-ini.json | 9 +-------- overlay/etc/bf/php.d/01-session.json | 7 +++++++ overlay/etc/bf/php.d/02-upload.json | 4 ++++ overlay/etc/bf/php.d/03-jit.json | 5 +++++ overlay/tmp/install | 1 + 5 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 overlay/etc/bf/php.d/01-session.json create mode 100644 overlay/etc/bf/php.d/02-upload.json create mode 100644 overlay/etc/bf/php.d/03-jit.json diff --git a/overlay/etc/bf/php.d/00-php-ini.json b/overlay/etc/bf/php.d/00-php-ini.json index 7cb5e1e..bea8905 100644 --- a/overlay/etc/bf/php.d/00-php-ini.json +++ b/overlay/etc/bf/php.d/00-php-ini.json @@ -2,12 +2,5 @@ "allow_url_fopen": "Off", "disable_functions": "phpinfo", "error_log": "", - "memory_limit": "256M", - "post_max_size": "64M", - "session.cookie_httponly": "1", - "session.cookie_secure": "1", - "session.gc_maxlifetime": "86400", - "session.name": "bf-nginx-php-sessid", - "session.use_strict_mode": "1", - "upload_max_filesize": "64M" + "memory_limit": "256M" } diff --git a/overlay/etc/bf/php.d/01-session.json b/overlay/etc/bf/php.d/01-session.json new file mode 100644 index 0000000..9faadf3 --- /dev/null +++ b/overlay/etc/bf/php.d/01-session.json @@ -0,0 +1,7 @@ +{ + "session.cookie_httponly": "1", + "session.cookie_secure": "1", + "session.gc_maxlifetime": "86400", + "session.name": "bf-nginx-php-sessid", + "session.use_strict_mode": "1" +} diff --git a/overlay/etc/bf/php.d/02-upload.json b/overlay/etc/bf/php.d/02-upload.json new file mode 100644 index 0000000..8697e3c --- /dev/null +++ b/overlay/etc/bf/php.d/02-upload.json @@ -0,0 +1,4 @@ +{ + "post_max_size": "64M", + "upload_max_filesize": "64M" +} diff --git a/overlay/etc/bf/php.d/03-jit.json b/overlay/etc/bf/php.d/03-jit.json new file mode 100644 index 0000000..97bc0f8 --- /dev/null +++ b/overlay/etc/bf/php.d/03-jit.json @@ -0,0 +1,5 @@ +{ + "opcache.enable": "1", + "opcache.jit": "tracing", + "opcache.jit_buffer_size": "128M" +} \ No newline at end of file diff --git a/overlay/tmp/install b/overlay/tmp/install index f2ff179..d4deafa 100644 --- a/overlay/tmp/install +++ b/overlay/tmp/install @@ -13,6 +13,7 @@ def main [] { let packages = [ $"($prefix)=($version)" $"($prefix)-fpm=($version)" + $"($prefix)-opcache=($version)" $"($prefix)-session=($version)" ] bf pkg install $packages