Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
php_version: [ '83', '84', '85' ]
php_version: [ '83', '84', '85', '86' ]
steps:
- uses: actions/checkout@v6

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
script: |
const matrix = {
platform: ['linux/amd64', 'linux/arm64'],
php_version: ['83', '84', '85'],
php_version: ['83', '84', '85', '86'],
}

// If this is a third-party pull request, skip ARM builds
Expand Down
58 changes: 51 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ RUN set -xe; \
gcc \
g++ \
make \
# Applies the cli-fpm patch to PHP's source (src/cli-fpm)
patch \
# Finds the libraries below for ./configure
pkg-config \
# Headers of the libraries PHP and its extensions use (runtime libraries in the `php` stage below)
Expand Down Expand Up @@ -82,8 +84,21 @@ ENV MAKEFLAGS='-j4'
# --fail makes sure that curl returns an error instead of fetching the 404 page
ARG FULL_PHP_VERSION
WORKDIR /tmp/php
RUN curl --location --silent --show-error --fail --retry 3 "https://www.php.net/distributions/php-${FULL_PHP_VERSION}.tar.gz" \
| tar xzC . --strip-components=1
# Pre-releases (alpha, beta, RC) are not on php.net/distributions: take the tag's source from GitHub
# (without the generated files, which `buildconf` below generates)
RUN case "${FULL_PHP_VERSION}" in \
*alpha*|*beta*|*RC*) url="https://github.com/php/php-src/archive/refs/tags/php-${FULL_PHP_VERSION}.tar.gz" ;; \
*) url="https://www.php.net/distributions/php-${FULL_PHP_VERSION}.tar.gz" ;; \
esac; \
curl --location --silent --show-error --fail --retry 3 "$url" | tar xzC . --strip-components=1

# One binary for php and php-fpm: `php` runs FPM when invoked as `php-fpm` (--enable-cli-fpm,
# https://github.com/php/php-src/pull/23558, not in PHP yet). FPM then maps the file that the CLI
# (Bref's bootstrap) already loaded: -12 to -16 ms of FPM cold start and 8 MB less memory.
# Applied when src/cli-fpm has a patch for this PHP version.
ARG PHP_VERSION
COPY --link src/cli-fpm /tmp/cli-fpm
RUN if [ -f "/tmp/cli-fpm/php-${PHP_VERSION}.patch" ]; then patch -p1 < "/tmp/cli-fpm/php-${PHP_VERSION}.patch"; fi

# Configure the build
# -fstack-protector-strong : Be paranoid about stack overflows
Expand All @@ -107,6 +122,7 @@ RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -ffunction-sections -fdata-
--with-config-file-scan-dir=/etc/php/conf.d:/opt/bref/etc/php/conf.d:/var/task/php/conf.d \
--enable-cli \
--enable-fpm \
$([ -f "/tmp/cli-fpm/php-${PHP_VERSION}.patch" ] && echo --enable-cli-fpm) \
--disable-cgi \
--disable-phpdbg \
--with-openssl \
Expand Down Expand Up @@ -138,11 +154,28 @@ RUN make -j "$(nproc)"
# Override PEAR's PHAR URL because pear.php.net is down
RUN set -xe; \
make install PEAR_INSTALLER_URL='https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar'; \
make clean
make clean; \
if [ -f "/tmp/cli-fpm/php-${PHP_VERSION}.patch" ]; then ln -sf ../bin/php /usr/local/sbin/php-fpm; fi

# Optional extensions installed with `pecl`, not enabled by default
RUN pecl install APCu
RUN pecl install redis-6.3.0
# APCu's latest release (5.1.28) does not compile with PHP 8.6: use its main branch (pinned) until 5.1.29
RUN if [ "${PHP_VERSION}" -ge 86 ]; then \
mkdir -p /tmp/apcu && cd /tmp/apcu \
&& curl --location --silent --show-error --fail --retry 3 https://github.com/krakjoe/apcu/archive/fb2c942552a3f5dab7f4dea4afb5cf0831222c57.tar.gz \
| tar xzC . --strip-components=1 \
&& phpize && ./configure && make && make install && cd / && rm -rf /tmp/apcu; \
else \
pecl install APCu; \
fi
# phpredis' latest release (6.3.0) does not compile with PHP 8.6: use its develop branch (pinned) until the next release
RUN if [ "${PHP_VERSION}" -ge 86 ]; then \
mkdir -p /tmp/redis && cd /tmp/redis \
&& curl --location --silent --show-error --fail --retry 3 https://github.com/phpredis/phpredis/archive/959dee1ca9ed55500cf90365419f8232eca3a99c.tar.gz \
| tar xzC . --strip-components=1 \
&& phpize && ./configure && make && make install && cd / && rm -rf /tmp/redis; \
else \
pecl install redis-6.3.0; \
fi

# Gather all extensions in one directory, independent of PHP's internal API version
RUN set -xe; \
Expand Down Expand Up @@ -200,7 +233,8 @@ RUN set -xe; \
[ -e /usr/lib/ssl/certs ] || ln -s /etc/ssl/certs /usr/lib/ssl/certs

COPY --link --from=build-environment /usr/local/bin/php /usr/local/bin/php
COPY --link --from=build-environment /usr/local/sbin/php-fpm /usr/local/sbin/php-fpm
# php-fpm is either a binary or a symlink to php (--enable-cli-fpm): copy the directory to keep symlinks
COPY --link --from=build-environment /usr/local/sbin/ /usr/local/sbin/
COPY --link --from=build-environment /usr/local/lib/php/extensions /usr/local/lib/php/extensions

COPY --link src/php.ini /etc/php/conf.d/50-bref.ini
Expand Down Expand Up @@ -237,7 +271,17 @@ FROM build-environment AS build-php
# Build the dev image with xdebug
FROM build-environment AS build-dev

RUN pecl install xdebug-3.5.0 && cp "$(php -r 'echo ini_get("extension_dir");')"/xdebug.so /tmp/xdebug.so
ARG PHP_VERSION
# xdebug's latest release (3.5.3) supports PHP up to 8.5: use its main branch (pinned) for PHP 8.6
RUN if [ "${PHP_VERSION}" -ge 86 ]; then \
mkdir -p /tmp/xdebug && cd /tmp/xdebug \
&& curl --location --silent --show-error --fail --retry 3 https://github.com/xdebug/xdebug/archive/64007df3a0925808022fb87b6c6f06febf058ee2.tar.gz \
| tar xzC . --strip-components=1 \
&& phpize && ./configure --enable-xdebug && make && make install && cd / && rm -rf /tmp/xdebug; \
else \
pecl install xdebug-3.5.0; \
fi; \
cp "$(php -r 'echo ini_get("extension_dir");')"/xdebug.so /tmp/xdebug.so


FROM php AS dev
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ default: docker-images


# Build Docker images *locally*
docker-images: docker-images-php-83 docker-images-php-84 docker-images-php-85
docker-images: docker-images-php-83 docker-images-php-84 docker-images-php-85 docker-images-php-86
docker-images-php-%:
PHP_VERSION=$* ${BAKE_COMMAND} --load


# Build and publish multi-architecture images to Docker Hub.
upload-to-docker-hub: upload-to-docker-hub-php-83 upload-to-docker-hub-php-84 upload-to-docker-hub-php-85
upload-to-docker-hub: upload-to-docker-hub-php-83 upload-to-docker-hub-php-84 upload-to-docker-hub-php-85 upload-to-docker-hub-php-86
upload-to-docker-hub-php-%:
# Make sure we have defined the docker tag
(test $(DOCKER_TAG)) && echo "Tagging images with \"${DOCKER_TAG}\"" || echo "You have to define environment variable DOCKER_TAG"
Expand All @@ -48,12 +48,12 @@ upload-to-docker-hub-php-%:
--set "php-dev.tags=bref/php-$*-dev:4" --set "php-dev.tags=bref/php-$*-dev:${DOCKER_TAG}"


test: test-83 test-84 test-85
test: test-83 test-84 test-85 test-86
test-%:
cd tests && $(MAKE) test-$*


clean: clean-83 clean-84 clean-85
clean: clean-83 clean-84 clean-85 clean-86
# Clear the build cache, else all images will be rebuilt using cached layers
docker builder prune
clean-%:
Expand Down
2 changes: 2 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ variable "FULL_PHP_VERSIONS" {
"83" = "8.3.37"
"84" = "8.4.28"
"85" = "8.5.13"
# Release candidate: final release planned for late November 2026
"86" = "8.6.0RC5"
}
}

Expand Down
Loading