From 5e76c7485b9ae6a630581e002e8b0fcb908956ba Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Fri, 20 Nov 2026 11:13:00 +0100 Subject: [PATCH] feat: PHP 8.6 tags (php8.6, laravel13-php8.6) PHP 8.5+ has OPcache built in, so the opcache extension is only built where php -m does not list it (this also unblocks 8.5 builds). PHP 8.6 images no longer ship pecl/PEAR: scripts/pecl-install uses pecl where it exists and otherwise builds the newest pecl.php.net release from source. On 8.6.0 only ev compiles today; redis, igbinary and imagick still use removed C APIs and stay out until their next release and a rebuild. The laravel13 alias stays on 8.5. Co-Authored-By: Claude Opus 5.5 --- Dockerfile | 19 +++++++++++-------- README.md | 6 ++++-- docker-bake.hcl | 14 ++++++++++++-- scripts/build.sh | 3 ++- scripts/pecl-install | 15 +++++++++++++++ scripts/publish.sh | 3 ++- 6 files changed, 46 insertions(+), 14 deletions(-) create mode 100755 scripts/pecl-install diff --git a/Dockerfile b/Dockerfile index d9fcf77..963b63d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # docker-laravel — Multi-version PHP + Nginx image for Laravel # # Build args: -# PHP_VERSION — 7.4 | 8.0 | 8.1 | 8.2 | 8.3 | 8.4 | 8.5 (default: 8.4) +# PHP_VERSION — 7.4 | 8.0 | 8.1 | 8.2 | 8.3 | 8.4 | 8.5 | 8.6 (default: 8.4) # NODE_MAJOR — Node.js major version (default: 22) # =========================================================================== ARG PHP_VERSION=8.4 @@ -48,13 +48,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # --------------------------------------------------------------------------- # PHP extensions # --------------------------------------------------------------------------- -# GD configure flags changed between PHP 7.x and 8.0 +# GD configure flags changed between PHP 7.x and 8.0. Since PHP 8.5 OPcache is built +# into PHP itself (already loaded in php:8.5-fpm and later), so it is only built before. RUN PHP_MAJOR=$(php -r "echo PHP_MAJOR_VERSION;") && \ if [ "$PHP_MAJOR" -ge 8 ]; then \ docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \ else \ docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr; \ fi && \ + OPCACHE_EXT=$(php -m | grep -q '^Zend OPcache$' || echo opcache) && \ docker-php-ext-install -j$(nproc) \ pdo_mysql \ pdo_pgsql \ @@ -69,13 +71,14 @@ RUN PHP_MAJOR=$(php -r "echo PHP_MAJOR_VERSION;") && \ xml \ soap \ intl \ - opcache + $OPCACHE_EXT -# PECL extensions (fail gracefully for bleeding-edge PHP) -RUN pecl install redis && docker-php-ext-enable redis || echo "NOTICE: redis unavailable for PHP ${PHP_VERSION}" -RUN pecl install ev && docker-php-ext-enable ev || echo "NOTICE: ev unavailable for PHP ${PHP_VERSION}" -RUN pecl install igbinary && docker-php-ext-enable igbinary || echo "NOTICE: igbinary unavailable for PHP ${PHP_VERSION}" -RUN pecl install imagick && docker-php-ext-enable imagick || echo "NOTICE: imagick unavailable for PHP ${PHP_VERSION}" +# PECL extensions (fail gracefully for bleeding-edge PHP; see scripts/pecl-install) +COPY scripts/pecl-install /usr/local/bin/pecl-install +RUN pecl-install redis || echo "NOTICE: redis unavailable for PHP ${PHP_VERSION}" +RUN pecl-install ev || echo "NOTICE: ev unavailable for PHP ${PHP_VERSION}" +RUN pecl-install igbinary || echo "NOTICE: igbinary unavailable for PHP ${PHP_VERSION}" +RUN pecl-install imagick || echo "NOTICE: imagick unavailable for PHP ${PHP_VERSION}" # --------------------------------------------------------------------------- # OPcache configuration (JIT enabled automatically for PHP 8.0+) diff --git a/README.md b/README.md index 4b56bc0..dc22a95 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A **runtime environment** for Laravel applications — not Laravel itself. This image provides everything a Laravel app needs to run: PHP-FPM, Nginx, Composer, Node.js, and a curated set of PHP extensions and system tools. Mount your Laravel project at `/var/www/html` and you're ready to go. -Built for PHP 7.4 through 8.5, covering Laravel 9 – 13. +Built for PHP 7.4 through 8.6, covering Laravel 9 – 13. ## Available Tags @@ -21,6 +21,7 @@ Built for PHP 7.4 through 8.5, covering Laravel 9 – 13. | `blaxsoftware/laravel:php8.3` | 8.3 | 10, 11, 12, 13 | | `blaxsoftware/laravel:php8.4` | 8.4 | 11, 12, 13 | | `blaxsoftware/laravel:php8.5` | 8.5 | 12, 13 | +| `blaxsoftware/laravel:php8.6` | 8.6 | 13 | | `blaxsoftware/laravel:latest` | 8.4 | (alias for php8.4) | ### By Laravel version (recommended PHP) @@ -52,6 +53,7 @@ blaxsoftware/laravel:laravel12-php8.5 blaxsoftware/laravel:laravel13-php8.3 blaxsoftware/laravel:laravel13-php8.4 blaxsoftware/laravel:laravel13-php8.5 +blaxsoftware/laravel:laravel13-php8.6 ``` ## Quick Start @@ -141,7 +143,7 @@ services: ## What's Included - **PHP-FPM** with extensions: pdo_mysql, pdo_pgsql, mysqli, mbstring, exif, pcntl, bcmath, gd (freetype + jpeg + webp), sockets, zip, xml, soap, intl, opcache -- **PECL**: redis, ev, igbinary, imagick (graceful fallback if unavailable for a PHP version) +- **PECL**: redis, ev, igbinary, imagick (graceful fallback if unavailable for a PHP version). PHP 8.6 images ship without `pecl`, so `scripts/pecl-install` builds the newest pecl.php.net release from source. On 2026-11-20 (PHP 8.6.0, one day old) only `ev` compiles; redis, igbinary and imagick still use C APIs 8.6 removed. Apps on `php8.6` use predis until a rebuild picks up phpredis. - **OPcache** with JIT auto-enabled on PHP 8.0+ - **Nginx** with headers-more module, optimized for Laravel - **X-Accel-Redirect** for files under `storage/app`: after its own access check the app answers with an empty body and `X-Accel-Redirect: /_accel/`, and nginx sends the file (Range requests, CORS headers passed on). The internal location is announced to PHP as `$_SERVER['X_ACCEL_STORAGE'] = '/_accel/'`, so an app can switch it on only when the image has it diff --git a/docker-bake.hcl b/docker-bake.hcl index 130b898..136f7bc 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -106,16 +106,26 @@ target "php-85" { tags = [tag("8.5")] } +target "php-86" { + context = "." + dockerfile = "Dockerfile" + args = { + PHP_VERSION = "8.6" + NODE_MAJOR = "${NODE_MAJOR}" + } + tags = [tag("8.6")] +} + # --------------------------------------------------------------------------- # Groups # --------------------------------------------------------------------------- group "default" { - targets = ["php-74", "php-80", "php-81", "php-82", "php-83", "php-84", "php-85"] + targets = ["php-74", "php-80", "php-81", "php-82", "php-83", "php-84", "php-85", "php-86"] } group "active" { - targets = ["php-82", "php-83", "php-84", "php-85"] + targets = ["php-82", "php-83", "php-84", "php-85", "php-86"] } group "legacy" { diff --git a/scripts/build.sh b/scripts/build.sh index 5ce1fb0..6f54f24 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -28,6 +28,7 @@ declare -A PHP_LARAVEL_MAP=( ["8.3"]="10 11 12 13" ["8.4"]="11 12 13" ["8.5"]="12 13" + ["8.6"]="13" ) # Recommended (highest) PHP version per Laravel version → gets the bare `laravelN` tag @@ -42,7 +43,7 @@ declare -A LARAVEL_RECOMMENDED_PHP=( # Which PHP version gets the `latest` tag LATEST_PHP="8.4" -ALL_PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5") +ALL_PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5" "8.6") # --------------------------------------------------------------------------- # Determine which versions to build diff --git a/scripts/pecl-install b/scripts/pecl-install new file mode 100755 index 0000000..eb2a9e3 --- /dev/null +++ b/scripts/pecl-install @@ -0,0 +1,15 @@ +#!/bin/sh +# pecl-install : build, install and enable a PECL extension. +# Uses `pecl` where the PHP image ships it. PHP 8.6+ images no longer include PEAR/pecl, +# so there it builds the newest release from the pecl.php.net source tarball instead. +set -e +ext="$1" +if command -v pecl >/dev/null 2>&1; then + pecl install "$ext" +else + dir="$(mktemp -d)" + curl -fsSL "https://pecl.php.net/get/$ext" | tar xz -C "$dir" --strip-components=1 + (cd "$dir" && phpize && ./configure && make -j"$(nproc)" && make install) + rm -rf "$dir" +fi +docker-php-ext-enable "$ext" diff --git a/scripts/publish.sh b/scripts/publish.sh index 3e27ec5..2eaec78 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -39,6 +39,7 @@ declare -A PHP_LARAVEL_MAP=( ["8.3"]="10 11 12 13" ["8.4"]="11 12 13" ["8.5"]="12 13" + ["8.6"]="13" ) declare -A LARAVEL_RECOMMENDED_PHP=( @@ -50,7 +51,7 @@ declare -A LARAVEL_RECOMMENDED_PHP=( ) LATEST_PHP="8.4" -ALL_PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5") +ALL_PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5" "8.6") # --------------------------------------------------------------------------- # Determine which versions to push