From 829e6c1cad805706543cb69ed1ec71ce1ee97e11 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Tue, 3 Nov 2026 19:13:10 +0100 Subject: [PATCH 1/6] Remove the pull of the previous images before the build: the builder does not use them as cache --- .github/workflows/workflow.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 31ac1391..2dcff97e 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -35,12 +35,6 @@ jobs: - name: Build run: | PHP_VERSION="${{ matrix.php_version }}" - # Get last cached successful builds - TAGS=$(REPO="ghcr.io/${{ github.repository_owner }}/php" TAG_PREFIX="" docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --progress=quiet --print | jq -r '.target[].tags[]') - for TAG in $TAGS; do - docker pull --quiet ${TAG} || echo "" - done; - # Build the current builds REPO="ghcr.io/${{ github.repository_owner }}/php" \ ARCH_SUFFIX="-${{ matrix.builder.arch }}" \ TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ From c8d2399dc8e9dd2e15f680c5afe9544a1a15975e Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 5 Nov 2026 13:13:14 +0100 Subject: [PATCH 2/6] Create the socket directory of mod_cgid in the images with Apache Apache is started without apache2ctl, which creates it: mod_cgid failed to start in the slim-apache image and with the built-in Apache of the fpm variant. The fat apache image only had it because an extension package started apache2ctl during its installation. --- CHANGELOG.md | 1 + Dockerfile.slim.apache | 1 + Dockerfile.slim.fpm | 1 + tests-suite/variant-apache.sh | 10 ++++++++++ utils/Dockerfile.slim.blueprint | 1 + 5 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd094f1a..3aa306a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * **2026-11-05** * The *apache* and *fpm* images stop right away when a `docker stop` is requested during a long startup step (e.g. a `STARTUP_COMMAND_*`, or the configuration of the extensions on a loaded host): they were killed after the stop timeout (exit code 137 after 10 s) + * Apache `mod_cgid` (`APACHE_EXTENSION_CGID=1`) starts in the *slim-apache* image and with the built-in Apache of the *fpm* variant: its socket directory was missing * **2026-11-03** * The `php` command is about 20 ms faster on each call: it detects the changes of the `PHP_*` environment variables without starting PHP a first time. The configuration is now also regenerated when a `PHP_*` variable is removed diff --git a/Dockerfile.slim.apache b/Dockerfile.slim.apache index f7cecd31..c6aff692 100644 --- a/Dockerfile.slim.apache +++ b/Dockerfile.slim.apache @@ -186,6 +186,7 @@ RUN set -eux; \ for dir in \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ + "$APACHE_RUN_DIR/socks" \ "$APACHE_LOG_DIR" \ ; do \ rm -rvf "$dir"; \ diff --git a/Dockerfile.slim.fpm b/Dockerfile.slim.fpm index 619b8b56..1b61293c 100644 --- a/Dockerfile.slim.fpm +++ b/Dockerfile.slim.fpm @@ -186,6 +186,7 @@ RUN set -eux; \ for dir in \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ + "$APACHE_RUN_DIR/socks" \ "$APACHE_LOG_DIR" \ ; do \ rm -rvf "$dir"; \ diff --git a/tests-suite/variant-apache.sh b/tests-suite/variant-apache.sh index 65091a96..9a384864 100755 --- a/tests-suite/variant-apache.sh +++ b/tests-suite/variant-apache.sh @@ -69,6 +69,16 @@ test_switchMpm() { assert_not_matches "ERROR" "$RESULT" "a2enmod/a2dismod failed" } ############################################################ +## mod_cgid starts (its socket directory exists) +############################################################ +test_cgid() { + for image in "slim-${BRANCH_VARIANT}" "${BRANCH_VARIANT}"; do + RESULT="$(docker run ${RUN_OPTIONS} --rm -e APACHE_EXTENSION_CGID=1 \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${image}${ARCH_SUFFIX}" bash -c 'timeout 3 apache2-foreground 2>&1')" + assert_not_matches "cgid:(error|crit)" "$RESULT" "mod_cgid does not start in the ${image} image" + done +} +############################################################ ## A stop requested during the initialization is not lost ############################################################ test_stopDuringStartup() { diff --git a/utils/Dockerfile.slim.blueprint b/utils/Dockerfile.slim.blueprint index a621a9e5..047e507a 100644 --- a/utils/Dockerfile.slim.blueprint +++ b/utils/Dockerfile.slim.blueprint @@ -185,6 +185,7 @@ RUN set -eux; \ for dir in \ "$APACHE_LOCK_DIR" \ "$APACHE_RUN_DIR" \ + "$APACHE_RUN_DIR/socks" \ "$APACHE_LOG_DIR" \ ; do \ rm -rvf "$dir"; \ From 30b7898aa5f9ea03cae60a43dc06a1b209faa0fe Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 5 Nov 2026 13:13:34 +0100 Subject: [PATCH 3/6] Build the 3 variants of a PHP version in one job, from common layers The slim Dockerfiles start from Dockerfile.base (the layers common to all the images). The extensions are installed once on Dockerfile.base (Dockerfile.extensions), then the slim Dockerfile of each variant is applied on them to build the fat images: the extensions were installed 3 times per PHP version and architecture. The images keep the same content (configuration, files, packages and PHP extensions of each SAPI compared on PHP 8.4). The CI builds and tests a PHP version and an architecture per job (8 jobs instead of 24) and runs the test files in parallel (tests-suite/run_tests.sh). The NodeJS images are now tested: variant-node.sh was run without NODE. --- .github/workflows/legacy-v5.yml | 7 +- .github/workflows/workflow.yml | 33 +- CHANGELOG.md | 2 + Dockerfile.apache | 19 +- Dockerfile.base | 164 +++++++ Dockerfile.cli | 19 +- Dockerfile.extensions | 16 + Dockerfile.fpm | 19 +- Dockerfile.slim.apache | 162 +------ Dockerfile.slim.cli | 162 +------ Dockerfile.slim.fpm | 162 +------ Makefile | 37 +- docker-bake.hcl | 616 ++++++++++++++++++++------ docs/contributing.md | 15 + orbit.yml | 2 + tests-suite/run_tests.sh | 58 +++ utils/Dockerfile.base.blueprint | 163 +++++++ utils/Dockerfile.blueprint | 19 +- utils/Dockerfile.extensions.blueprint | 15 + utils/Dockerfile.slim.blueprint | 162 +------ utils/docker-bake.blueprint.hcl | 42 +- 21 files changed, 1017 insertions(+), 877 deletions(-) create mode 100644 Dockerfile.base create mode 100644 Dockerfile.extensions create mode 100755 tests-suite/run_tests.sh create mode 100644 utils/Dockerfile.base.blueprint create mode 100644 utils/Dockerfile.extensions.blueprint diff --git a/.github/workflows/legacy-v5.yml b/.github/workflows/legacy-v5.yml index 17470df9..cba69dd7 100644 --- a/.github/workflows/legacy-v5.yml +++ b/.github/workflows/legacy-v5.yml @@ -34,8 +34,7 @@ jobs: TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ docker buildx bake \ --set "*.platform=linux/${{ matrix.builder.arch }}" \ - --set "*.output=type=docker" \ - --load --progress=quiet \ + --progress=quiet \ ${BAKE_GROUP//.} - name: Display tags built run: | @@ -57,7 +56,7 @@ jobs: TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ docker buildx bake \ --print --progress=quiet \ - ${BAKE_GROUP//.} | jq -r '.target[].tags[]'); + ${BAKE_GROUP//.} | jq -r '.target[].tags // [] | .[]'); for TAG in $TAGS; do docker push --quiet ${TAG}; done; merge-and-publish: @@ -113,7 +112,7 @@ jobs: TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ docker buildx bake \ --print --progress=quiet \ - ${BAKE_GROUP//.} | jq '.target[].tags[]' + ${BAKE_GROUP//.} | jq '.target[].tags // [] | .[]' - name: Create multiarch manifests run: | # Get all targets from the bake group diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 2dcff97e..ed144a2f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -17,10 +17,9 @@ jobs: fail-fast: false matrix: php_version: ['8.5', '8.4', '8.3', '8.2'] - variant: ['apache','cli','fpm'] builder: [ {arch: "amd64", os: "ubuntu-24.04"}, {arch: "arm64", os: "ubuntu-24.04-arm"}] runs-on: ${{ matrix.builder.os }} - name: Build&test ${{ matrix.php_version }}-${{ matrix.variant }} ${{ matrix.builder.arch }} + name: Build&test ${{ matrix.php_version }} ${{ matrix.builder.arch }} steps: - name: Checkout uses: actions/checkout@v7 @@ -40,22 +39,23 @@ jobs: TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ docker buildx bake \ --set "*.platform=linux/${{ matrix.builder.arch }}" \ - --set "*.output=type=docker" \ - --load --progress=quiet \ - php${PHP_VERSION//.}-${{ matrix.variant }}-all + --progress=quiet \ + php${PHP_VERSION//.} - name: Display tags built run: | docker image ls --filter="reference=ghcr.io/${{ github.repository_owner }}/php" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}" - name: Test run: | + PHP_VERSION="${{ matrix.php_version }}" REPO="ghcr.io/${{ github.repository_owner }}/php" \ TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ - PHP_VERSION="${{ matrix.php_version }}" \ + PHP_VERSION="${PHP_VERSION}" \ ARCH_SUFFIX="-${{ matrix.builder.arch }}" \ BRANCH="v5" \ - VARIANT="${{ matrix.variant }}" \ PLATFORM="linux/${{ matrix.builder.arch }}" \ - ./tests-suite/bash_unit -f tap ./tests-suite/*.sh + VARIANTS="apache cli fpm" \ + NODE_VERSIONS="$(docker buildx bake --print --progress=quiet php${PHP_VERSION//.} | jq -r '[.target[].args.NODE_VERSION // empty] | unique | join(" ")')" \ + ./tests-suite/run_tests.sh - name: Publish specific arch version if: > # Only from the main repo github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || @@ -67,7 +67,7 @@ jobs: TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ docker buildx bake \ --print --progress=quiet \ - php${PHP_VERSION//.}-${{ matrix.variant }}-all | jq -r '.target[].tags[]'); + php${PHP_VERSION//.} | jq -r '.target[].tags // [] | .[]'); for TAG in $TAGS; do docker push --quiet ${TAG}; done; merge-and-publish: @@ -75,12 +75,11 @@ jobs: needs: - build runs-on: ubuntu-latest - name: Merge and publish ${{ matrix.php_version }}-${{ matrix.variant }} + name: Merge and publish ${{ matrix.php_version }} strategy: fail-fast: false matrix: php_version: ['8.5', '8.4', '8.3', '8.2'] - variant: ['apache','cli','fpm'] steps: - name: Checkout uses: actions/checkout@v7 @@ -105,12 +104,12 @@ jobs: - name: Fetch minor version of php run: | # Pull amd64 slim image to get PHP version - docker pull --quiet ghcr.io/${{ github.repository_owner }}/php:rc${GITHUB_RUN_ID}-${{ matrix.php_version }}-v5-slim-${{ matrix.variant }}-amd64 + docker pull --quiet ghcr.io/${{ github.repository_owner }}/php:rc${GITHUB_RUN_ID}-${{ matrix.php_version }}-v5-slim-cli-amd64 # Retrieve minor - PHP_PATCH_MINOR=`docker run --rm ghcr.io/${{ github.repository_owner }}/php:rc${GITHUB_RUN_ID}-${{ matrix.php_version }}-v5-slim-${{ matrix.variant }}-amd64 php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` + PHP_PATCH_MINOR=`docker run --rm ghcr.io/${{ github.repository_owner }}/php:rc${GITHUB_RUN_ID}-${{ matrix.php_version }}-v5-slim-cli-amd64 php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV - - name: Get list of images for this variant + - name: Get list of images for this PHP version id: get-images run: | PHP_VERSION="${{ matrix.php_version }}" @@ -118,13 +117,13 @@ jobs: TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ docker buildx bake \ --print --progress=quiet \ - php${PHP_VERSION//.}-${{ matrix.variant }}-all | jq '.target[].tags[]' + php${PHP_VERSION//.} | jq '.target[].tags // [] | .[]' - name: Create multiarch manifests run: | PHP_VERSION="${{ matrix.php_version }}" - # Get all targets from the bake group - TARGETS=$(docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --progress=quiet --print | jq -r ".group[\"php${PHP_VERSION//.}-${{ matrix.variant }}-all\"].targets[]") + # Get all the published targets of the bake group + TARGETS=$(docker buildx bake php${PHP_VERSION//.} --progress=quiet --print | jq -r '.target | to_entries[] | select(.value.tags) | .key') for TARGET in $TARGETS; do TAG_ORI=$(REPO="ghcr.io/${{ github.repository_owner }}/php" TAG_PREFIX="rc${GITHUB_RUN_ID}-" docker buildx bake ${TARGET} --progress=quiet --print | jq -r ".target | to_entries[] | select(.key == \"${TARGET}\") | .value.tags[0]") diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aa306a8..e875f68c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * **2026-11-05** * The *apache* and *fpm* images stop right away when a `docker stop` is requested during a long startup step (e.g. a `STARTUP_COMMAND_*`, or the configuration of the extensions on a loaded host): they were killed after the stop timeout (exit code 137 after 10 s) * Apache `mod_cgid` (`APACHE_EXTENSION_CGID=1`) starts in the *slim-apache* image and with the built-in Apache of the *fpm* variant: its socket directory was missing + * The images of a PHP version are built from common layers: the extensions are installed once for the 3 variants. The *fat* images no longer contain the layers of the *slim* image of their variant, their content is unchanged + * The NodeJS images are tested by the CI * **2026-11-03** * The `php` command is about 20 ms faster on each call: it detects the changes of the `PHP_*` environment variables without starting PHP a first time. The configuration is now also regenerated when a `PHP_*` variable is removed diff --git a/Dockerfile.apache b/Dockerfile.apache index abd1ae21..e472e62f 100644 --- a/Dockerfile.apache +++ b/Dockerfile.apache @@ -3,13 +3,9 @@ ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG INSTALL_LOCALES=1 -ARG PHP_VERSION="8.4" -ARG GLOBAL_VERSION="v5" -ARG REPO="thecodingmachine/php" -ARG TAG_PREFIX="" -ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache" -FROM ${FROM_IMAGE} +# The slim Dockerfile of the variant applied on Dockerfile.extensions (see docker-bake.hcl) +FROM slim-with-extensions LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -17,15 +13,10 @@ ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=2 -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - +# The packages of the variant enable all the extensions installed before them: enable only the ones of the slim image USER root -RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh +RUN /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash && \ + cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./disable_all.sh USER docker # |-------------------------------------------------------------------------- diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 00000000..28f1da12 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,164 @@ +#syntax=docker/dockerfile-upstream:1 +# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) +FROM ubuntu:24.04 +LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Fixes some weird terminal issues such as broken clear / CTRL+L +#ENV TERM=linux + +# Ensure apt doesn't ask questions when installing stuff +ENV DEBIAN_FRONTEND=noninteractive + +ARG PHP_VERSION +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=2 + +ENV TARGETOS=${TARGETOS} +ENV TARGETARCH=${TARGETARCH} +ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV PHP_VERSION=${PHP_VERSION} + +# |-------------------------------------------------------------------------- +# | Main PHP extensions +# |-------------------------------------------------------------------------- +# | +# | Installs the main PHP extensions +# | + +# Install php an other packages +RUN apt update \ + && apt upgrade -y \ + && apt install -y --no-install-recommends curl ca-certificates \ + && curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb \ + && dpkg -i /tmp/debsuryorg-archive-keyring.deb \ + && . /etc/os-release \ + && echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/php.list \ + && apt update \ + && apt install -y --no-install-recommends \ + nano \ + sudo \ + git \ + iproute2 \ + procps \ + curl \ + unzip \ + ca-certificates \ + openssh-client \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* +# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist +RUN OPCACHE_PACKAGE="" \ + && if [ "${PHP_VERSION}" != "8.5" ]; then \ + OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \ + fi \ + && apt update \ + && apt install -y --no-install-recommends \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-mbstring \ + ${OPCACHE_PACKAGE} \ + php${PHP_VERSION}-readline \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-zip \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# |-------------------------------------------------------------------------- +# | User +# |-------------------------------------------------------------------------- +# | +# | Define a default user with sudo rights. +# | + +RUN userdel ubuntu && rm -rf /home/ubuntu +RUN useradd -ms /bin/bash docker && adduser docker sudo +# Users in the sudoers group can sudo as root without password. +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sudo + +# |-------------------------------------------------------------------------- +# | Default php.ini file +# |-------------------------------------------------------------------------- +# | +# | For some reasons, the official image has a php.ini-production.cli file +# | but no php.ini-development.cli file. Let's create this one. +# | + +RUN cp /usr/lib/php/${PHP_VERSION}/php.ini-development /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ + sed -i 's/^disable_functions/;disable_functions/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ + sed -i 's/^memory_limit = .*/memory_limit = -1/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli + +#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-production /usr/local/etc/php/php.ini-production +#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-development /usr/local/etc/php/php.ini-development +#RUN chmod 644 /usr/local/etc/php/php.ini-* + +ENV TEMPLATE_PHP_INI=development + +# Let's remove the default CLI php.ini file (it will be copied from TEMPLATE_PHP_INI) +RUN rm /etc/php/${PHP_VERSION}/cli/php.ini + +# |-------------------------------------------------------------------------- +# | Composer +# |-------------------------------------------------------------------------- +# | +# | Installs Composer to easily manage your PHP dependencies. +# | + +#ENV COMPOSER_ALLOW_SUPERUSER 1 + +RUN curl -sS --retry 5 --retry-delay 2 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer &&\ + chmod +x /usr/local/bin/composer +COPY utils/select_composer_version.sh /usr/local/bin/select_composer_version.sh + +# TODO: utils.php in /usr/local/bin... bof! +COPY utils/utils.php /usr/local/bin/utils.php +RUN mv /usr/bin/php /usr/bin/real_php +COPY utils/php_proxy.sh /usr/bin/php +COPY utils/php_env_fingerprint.sh /usr/local/bin/php_env_fingerprint.sh +RUN touch /opt/php_env_fingerprint +COPY utils/generate_conf.php /usr/local/bin/generate_conf.php +COPY utils/setup_extensions.php /usr/local/bin/setup_extensions.php + +# |-------------------------------------------------------------------------- +# | Default PHP extensions to be enabled +# | By default, enable all the extensions that are enabled on a base Ubuntu install +# |-------------------------------------------------------------------------- +ENV PHP_EXTENSION_CALENDAR=1 \ + PHP_EXTENSION_CTYPE=1 \ + PHP_EXTENSION_CURL=1 \ + PHP_EXTENSION_DOM=1 \ + PHP_EXTENSION_EXIF=1 \ + PHP_EXTENSION_FILEINFO=1 \ + PHP_EXTENSION_FTP=1 \ + PHP_EXTENSION_GETTEXT=1 \ + PHP_EXTENSION_ICONV=1 \ + PHP_EXTENSION_JSON=1 \ + PHP_EXTENSION_MBSTRING=1 \ + PHP_EXTENSION_OPCACHE=1 \ + PHP_EXTENSION_PDO=1 \ + PHP_EXTENSION_PHAR=1 \ + PHP_EXTENSION_POSIX=1 \ + PHP_EXTENSION_READLINE=1 \ + PHP_EXTENSION_SHMOP=1 \ + PHP_EXTENSION_SIMPLEXML=1 \ + PHP_EXTENSION_SOCKETS=1 \ + PHP_EXTENSION_SYSVMSG=1 \ + PHP_EXTENSION_SYSVSEM=1 \ + PHP_EXTENSION_SYSVSHM=1 \ + PHP_EXTENSION_TOKENIZER=1 \ + PHP_EXTENSION_WDDX=1 \ + PHP_EXTENSION_XML=1 \ + PHP_EXTENSION_XMLREADER=1 \ + PHP_EXTENSION_XMLWRITER=1 \ + PHP_EXTENSION_XSL=1 \ + PHP_EXTENSION_ZIP=1 + +USER docker +RUN composer global require bamarni/symfony-console-autocomplete && \ + rm -rf ~/.composer/cache + +USER root + +COPY extensions/ /usr/local/lib/thecodingmachine-php/extensions +RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current diff --git a/Dockerfile.cli b/Dockerfile.cli index 61d91277..e472e62f 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -3,13 +3,9 @@ ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG INSTALL_LOCALES=1 -ARG PHP_VERSION="8.4" -ARG GLOBAL_VERSION="v5" -ARG REPO="thecodingmachine/php" -ARG TAG_PREFIX="" -ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli" -FROM ${FROM_IMAGE} +# The slim Dockerfile of the variant applied on Dockerfile.extensions (see docker-bake.hcl) +FROM slim-with-extensions LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -17,15 +13,10 @@ ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=2 -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - +# The packages of the variant enable all the extensions installed before them: enable only the ones of the slim image USER root -RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh +RUN /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash && \ + cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./disable_all.sh USER docker # |-------------------------------------------------------------------------- diff --git a/Dockerfile.extensions b/Dockerfile.extensions new file mode 100644 index 00000000..197aef4d --- /dev/null +++ b/Dockerfile.extensions @@ -0,0 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 +# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) +FROM base + +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=2 + +# |-------------------------------------------------------------------------- +# | Main PHP extensions +# |-------------------------------------------------------------------------- +# | +# | Installs the main PHP extensions, shared by the fat images of all the variants +# | + +RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh diff --git a/Dockerfile.fpm b/Dockerfile.fpm index bfa0abb9..e472e62f 100644 --- a/Dockerfile.fpm +++ b/Dockerfile.fpm @@ -3,13 +3,9 @@ ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG INSTALL_LOCALES=1 -ARG PHP_VERSION="8.4" -ARG GLOBAL_VERSION="v5" -ARG REPO="thecodingmachine/php" -ARG TAG_PREFIX="" -ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-fpm" -FROM ${FROM_IMAGE} +# The slim Dockerfile of the variant applied on Dockerfile.extensions (see docker-bake.hcl) +FROM slim-with-extensions LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -17,15 +13,10 @@ ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=2 -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - +# The packages of the variant enable all the extensions installed before them: enable only the ones of the slim image USER root -RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh +RUN /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash && \ + cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./disable_all.sh USER docker # |-------------------------------------------------------------------------- diff --git a/Dockerfile.slim.apache b/Dockerfile.slim.apache index c6aff692..1482863e 100644 --- a/Dockerfile.slim.apache +++ b/Dockerfile.slim.apache @@ -1,168 +1,12 @@ #syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM ubuntu:24.04 -LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " -SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# "base" is Dockerfile.base for the slim images, Dockerfile.extensions for the fat ones (see docker-bake.hcl) +FROM base -# Fixes some weird terminal issues such as broken clear / CTRL+L -#ENV TERM=linux - -# Ensure apt doesn't ask questions when installing stuff -ENV DEBIAN_FRONTEND=noninteractive - -ARG PHP_VERSION -ARG TARGETOS -ARG TARGETARCH -ARG BLACKFIRE_VERSION=2 ONBUILD ARG TARGETOS=${TARGETOS} ONBUILD ARG TARGETARCH=${TARGETARCH} ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV TARGETOS=${TARGETOS} -ENV TARGETARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV PHP_VERSION=${PHP_VERSION} - -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - -# Install php an other packages -RUN apt update \ - && apt upgrade -y \ - && apt install -y --no-install-recommends curl ca-certificates \ - && curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb \ - && dpkg -i /tmp/debsuryorg-archive-keyring.deb \ - && . /etc/os-release \ - && echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/php.list \ - && apt update \ - && apt install -y --no-install-recommends \ - nano \ - sudo \ - git \ - iproute2 \ - procps \ - curl \ - unzip \ - ca-certificates \ - openssh-client \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* -# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist -RUN OPCACHE_PACKAGE="" \ - && if [ "${PHP_VERSION}" != "8.5" ]; then \ - OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \ - fi \ - && apt update \ - && apt install -y --no-install-recommends \ - php${PHP_VERSION}-cli \ - php${PHP_VERSION}-curl \ - php${PHP_VERSION}-mbstring \ - ${OPCACHE_PACKAGE} \ - php${PHP_VERSION}-readline \ - php${PHP_VERSION}-xml \ - php${PHP_VERSION}-zip \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -# |-------------------------------------------------------------------------- -# | User -# |-------------------------------------------------------------------------- -# | -# | Define a default user with sudo rights. -# | - -RUN userdel ubuntu && rm -rf /home/ubuntu -RUN useradd -ms /bin/bash docker && adduser docker sudo -# Users in the sudoers group can sudo as root without password. -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sudo - -# |-------------------------------------------------------------------------- -# | Default php.ini file -# |-------------------------------------------------------------------------- -# | -# | For some reasons, the official image has a php.ini-production.cli file -# | but no php.ini-development.cli file. Let's create this one. -# | - -RUN cp /usr/lib/php/${PHP_VERSION}/php.ini-development /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^disable_functions/;disable_functions/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^memory_limit = .*/memory_limit = -1/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli - -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-production /usr/local/etc/php/php.ini-production -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-development /usr/local/etc/php/php.ini-development -#RUN chmod 644 /usr/local/etc/php/php.ini-* - -ENV TEMPLATE_PHP_INI=development - -# Let's remove the default CLI php.ini file (it will be copied from TEMPLATE_PHP_INI) -RUN rm /etc/php/${PHP_VERSION}/cli/php.ini - -# |-------------------------------------------------------------------------- -# | Composer -# |-------------------------------------------------------------------------- -# | -# | Installs Composer to easily manage your PHP dependencies. -# | - -#ENV COMPOSER_ALLOW_SUPERUSER 1 - -RUN curl -sS --retry 5 --retry-delay 2 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer &&\ - chmod +x /usr/local/bin/composer -COPY utils/select_composer_version.sh /usr/local/bin/select_composer_version.sh - -# TODO: utils.php in /usr/local/bin... bof! -COPY utils/utils.php /usr/local/bin/utils.php -RUN mv /usr/bin/php /usr/bin/real_php -COPY utils/php_proxy.sh /usr/bin/php -COPY utils/php_env_fingerprint.sh /usr/local/bin/php_env_fingerprint.sh -RUN touch /opt/php_env_fingerprint -COPY utils/generate_conf.php /usr/local/bin/generate_conf.php -COPY utils/setup_extensions.php /usr/local/bin/setup_extensions.php - -# |-------------------------------------------------------------------------- -# | Default PHP extensions to be enabled -# | By default, enable all the extensions that are enabled on a base Ubuntu install -# |-------------------------------------------------------------------------- -ENV PHP_EXTENSION_CALENDAR=1 \ - PHP_EXTENSION_CTYPE=1 \ - PHP_EXTENSION_CURL=1 \ - PHP_EXTENSION_DOM=1 \ - PHP_EXTENSION_EXIF=1 \ - PHP_EXTENSION_FILEINFO=1 \ - PHP_EXTENSION_FTP=1 \ - PHP_EXTENSION_GETTEXT=1 \ - PHP_EXTENSION_ICONV=1 \ - PHP_EXTENSION_JSON=1 \ - PHP_EXTENSION_MBSTRING=1 \ - PHP_EXTENSION_OPCACHE=1 \ - PHP_EXTENSION_PDO=1 \ - PHP_EXTENSION_PHAR=1 \ - PHP_EXTENSION_POSIX=1 \ - PHP_EXTENSION_READLINE=1 \ - PHP_EXTENSION_SHMOP=1 \ - PHP_EXTENSION_SIMPLEXML=1 \ - PHP_EXTENSION_SOCKETS=1 \ - PHP_EXTENSION_SYSVMSG=1 \ - PHP_EXTENSION_SYSVSEM=1 \ - PHP_EXTENSION_SYSVSHM=1 \ - PHP_EXTENSION_TOKENIZER=1 \ - PHP_EXTENSION_WDDX=1 \ - PHP_EXTENSION_XML=1 \ - PHP_EXTENSION_XMLREADER=1 \ - PHP_EXTENSION_XMLWRITER=1 \ - PHP_EXTENSION_XSL=1 \ - PHP_EXTENSION_ZIP=1 - -USER docker -RUN composer global require bamarni/symfony-console-autocomplete && \ - rm -rf ~/.composer/cache - -USER root - # Apache: built-in web server of the fpm variant (disabled by default, see PHP_FPM_WEB_SERVER) ENV APACHE_CONFDIR=/etc/apache2 @@ -339,8 +183,6 @@ COPY utils/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY utils/docker-entrypoint-as-root.sh /usr/local/bin/docker-entrypoint-as-root.sh COPY utils/supervise.sh /usr/local/bin/supervise.sh -COPY extensions/ /usr/local/lib/thecodingmachine-php/extensions -RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/Dockerfile.slim.cli b/Dockerfile.slim.cli index 92e66fca..b0e3a21a 100644 --- a/Dockerfile.slim.cli +++ b/Dockerfile.slim.cli @@ -1,168 +1,12 @@ #syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM ubuntu:24.04 -LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " -SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# "base" is Dockerfile.base for the slim images, Dockerfile.extensions for the fat ones (see docker-bake.hcl) +FROM base -# Fixes some weird terminal issues such as broken clear / CTRL+L -#ENV TERM=linux - -# Ensure apt doesn't ask questions when installing stuff -ENV DEBIAN_FRONTEND=noninteractive - -ARG PHP_VERSION -ARG TARGETOS -ARG TARGETARCH -ARG BLACKFIRE_VERSION=2 ONBUILD ARG TARGETOS=${TARGETOS} ONBUILD ARG TARGETARCH=${TARGETARCH} ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV TARGETOS=${TARGETOS} -ENV TARGETARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV PHP_VERSION=${PHP_VERSION} - -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - -# Install php an other packages -RUN apt update \ - && apt upgrade -y \ - && apt install -y --no-install-recommends curl ca-certificates \ - && curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb \ - && dpkg -i /tmp/debsuryorg-archive-keyring.deb \ - && . /etc/os-release \ - && echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/php.list \ - && apt update \ - && apt install -y --no-install-recommends \ - nano \ - sudo \ - git \ - iproute2 \ - procps \ - curl \ - unzip \ - ca-certificates \ - openssh-client \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* -# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist -RUN OPCACHE_PACKAGE="" \ - && if [ "${PHP_VERSION}" != "8.5" ]; then \ - OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \ - fi \ - && apt update \ - && apt install -y --no-install-recommends \ - php${PHP_VERSION}-cli \ - php${PHP_VERSION}-curl \ - php${PHP_VERSION}-mbstring \ - ${OPCACHE_PACKAGE} \ - php${PHP_VERSION}-readline \ - php${PHP_VERSION}-xml \ - php${PHP_VERSION}-zip \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -# |-------------------------------------------------------------------------- -# | User -# |-------------------------------------------------------------------------- -# | -# | Define a default user with sudo rights. -# | - -RUN userdel ubuntu && rm -rf /home/ubuntu -RUN useradd -ms /bin/bash docker && adduser docker sudo -# Users in the sudoers group can sudo as root without password. -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sudo - -# |-------------------------------------------------------------------------- -# | Default php.ini file -# |-------------------------------------------------------------------------- -# | -# | For some reasons, the official image has a php.ini-production.cli file -# | but no php.ini-development.cli file. Let's create this one. -# | - -RUN cp /usr/lib/php/${PHP_VERSION}/php.ini-development /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^disable_functions/;disable_functions/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^memory_limit = .*/memory_limit = -1/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli - -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-production /usr/local/etc/php/php.ini-production -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-development /usr/local/etc/php/php.ini-development -#RUN chmod 644 /usr/local/etc/php/php.ini-* - -ENV TEMPLATE_PHP_INI=development - -# Let's remove the default CLI php.ini file (it will be copied from TEMPLATE_PHP_INI) -RUN rm /etc/php/${PHP_VERSION}/cli/php.ini - -# |-------------------------------------------------------------------------- -# | Composer -# |-------------------------------------------------------------------------- -# | -# | Installs Composer to easily manage your PHP dependencies. -# | - -#ENV COMPOSER_ALLOW_SUPERUSER 1 - -RUN curl -sS --retry 5 --retry-delay 2 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer &&\ - chmod +x /usr/local/bin/composer -COPY utils/select_composer_version.sh /usr/local/bin/select_composer_version.sh - -# TODO: utils.php in /usr/local/bin... bof! -COPY utils/utils.php /usr/local/bin/utils.php -RUN mv /usr/bin/php /usr/bin/real_php -COPY utils/php_proxy.sh /usr/bin/php -COPY utils/php_env_fingerprint.sh /usr/local/bin/php_env_fingerprint.sh -RUN touch /opt/php_env_fingerprint -COPY utils/generate_conf.php /usr/local/bin/generate_conf.php -COPY utils/setup_extensions.php /usr/local/bin/setup_extensions.php - -# |-------------------------------------------------------------------------- -# | Default PHP extensions to be enabled -# | By default, enable all the extensions that are enabled on a base Ubuntu install -# |-------------------------------------------------------------------------- -ENV PHP_EXTENSION_CALENDAR=1 \ - PHP_EXTENSION_CTYPE=1 \ - PHP_EXTENSION_CURL=1 \ - PHP_EXTENSION_DOM=1 \ - PHP_EXTENSION_EXIF=1 \ - PHP_EXTENSION_FILEINFO=1 \ - PHP_EXTENSION_FTP=1 \ - PHP_EXTENSION_GETTEXT=1 \ - PHP_EXTENSION_ICONV=1 \ - PHP_EXTENSION_JSON=1 \ - PHP_EXTENSION_MBSTRING=1 \ - PHP_EXTENSION_OPCACHE=1 \ - PHP_EXTENSION_PDO=1 \ - PHP_EXTENSION_PHAR=1 \ - PHP_EXTENSION_POSIX=1 \ - PHP_EXTENSION_READLINE=1 \ - PHP_EXTENSION_SHMOP=1 \ - PHP_EXTENSION_SIMPLEXML=1 \ - PHP_EXTENSION_SOCKETS=1 \ - PHP_EXTENSION_SYSVMSG=1 \ - PHP_EXTENSION_SYSVSEM=1 \ - PHP_EXTENSION_SYSVSHM=1 \ - PHP_EXTENSION_TOKENIZER=1 \ - PHP_EXTENSION_WDDX=1 \ - PHP_EXTENSION_XML=1 \ - PHP_EXTENSION_XMLREADER=1 \ - PHP_EXTENSION_XMLWRITER=1 \ - PHP_EXTENSION_XSL=1 \ - PHP_EXTENSION_ZIP=1 - -USER docker -RUN composer global require bamarni/symfony-console-autocomplete && \ - rm -rf ~/.composer/cache - -USER root - @@ -251,8 +95,6 @@ COPY utils/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY utils/docker-entrypoint-as-root.sh /usr/local/bin/docker-entrypoint-as-root.sh COPY utils/supervise.sh /usr/local/bin/supervise.sh -COPY extensions/ /usr/local/lib/thecodingmachine-php/extensions -RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/Dockerfile.slim.fpm b/Dockerfile.slim.fpm index 1b61293c..94d56317 100644 --- a/Dockerfile.slim.fpm +++ b/Dockerfile.slim.fpm @@ -1,168 +1,12 @@ #syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM ubuntu:24.04 -LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " -SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# "base" is Dockerfile.base for the slim images, Dockerfile.extensions for the fat ones (see docker-bake.hcl) +FROM base -# Fixes some weird terminal issues such as broken clear / CTRL+L -#ENV TERM=linux - -# Ensure apt doesn't ask questions when installing stuff -ENV DEBIAN_FRONTEND=noninteractive - -ARG PHP_VERSION -ARG TARGETOS -ARG TARGETARCH -ARG BLACKFIRE_VERSION=2 ONBUILD ARG TARGETOS=${TARGETOS} ONBUILD ARG TARGETARCH=${TARGETARCH} ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV TARGETOS=${TARGETOS} -ENV TARGETARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV PHP_VERSION=${PHP_VERSION} - -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - -# Install php an other packages -RUN apt update \ - && apt upgrade -y \ - && apt install -y --no-install-recommends curl ca-certificates \ - && curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb \ - && dpkg -i /tmp/debsuryorg-archive-keyring.deb \ - && . /etc/os-release \ - && echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/php.list \ - && apt update \ - && apt install -y --no-install-recommends \ - nano \ - sudo \ - git \ - iproute2 \ - procps \ - curl \ - unzip \ - ca-certificates \ - openssh-client \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* -# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist -RUN OPCACHE_PACKAGE="" \ - && if [ "${PHP_VERSION}" != "8.5" ]; then \ - OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \ - fi \ - && apt update \ - && apt install -y --no-install-recommends \ - php${PHP_VERSION}-cli \ - php${PHP_VERSION}-curl \ - php${PHP_VERSION}-mbstring \ - ${OPCACHE_PACKAGE} \ - php${PHP_VERSION}-readline \ - php${PHP_VERSION}-xml \ - php${PHP_VERSION}-zip \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -# |-------------------------------------------------------------------------- -# | User -# |-------------------------------------------------------------------------- -# | -# | Define a default user with sudo rights. -# | - -RUN userdel ubuntu && rm -rf /home/ubuntu -RUN useradd -ms /bin/bash docker && adduser docker sudo -# Users in the sudoers group can sudo as root without password. -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sudo - -# |-------------------------------------------------------------------------- -# | Default php.ini file -# |-------------------------------------------------------------------------- -# | -# | For some reasons, the official image has a php.ini-production.cli file -# | but no php.ini-development.cli file. Let's create this one. -# | - -RUN cp /usr/lib/php/${PHP_VERSION}/php.ini-development /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^disable_functions/;disable_functions/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^memory_limit = .*/memory_limit = -1/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli - -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-production /usr/local/etc/php/php.ini-production -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-development /usr/local/etc/php/php.ini-development -#RUN chmod 644 /usr/local/etc/php/php.ini-* - -ENV TEMPLATE_PHP_INI=development - -# Let's remove the default CLI php.ini file (it will be copied from TEMPLATE_PHP_INI) -RUN rm /etc/php/${PHP_VERSION}/cli/php.ini - -# |-------------------------------------------------------------------------- -# | Composer -# |-------------------------------------------------------------------------- -# | -# | Installs Composer to easily manage your PHP dependencies. -# | - -#ENV COMPOSER_ALLOW_SUPERUSER 1 - -RUN curl -sS --retry 5 --retry-delay 2 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer &&\ - chmod +x /usr/local/bin/composer -COPY utils/select_composer_version.sh /usr/local/bin/select_composer_version.sh - -# TODO: utils.php in /usr/local/bin... bof! -COPY utils/utils.php /usr/local/bin/utils.php -RUN mv /usr/bin/php /usr/bin/real_php -COPY utils/php_proxy.sh /usr/bin/php -COPY utils/php_env_fingerprint.sh /usr/local/bin/php_env_fingerprint.sh -RUN touch /opt/php_env_fingerprint -COPY utils/generate_conf.php /usr/local/bin/generate_conf.php -COPY utils/setup_extensions.php /usr/local/bin/setup_extensions.php - -# |-------------------------------------------------------------------------- -# | Default PHP extensions to be enabled -# | By default, enable all the extensions that are enabled on a base Ubuntu install -# |-------------------------------------------------------------------------- -ENV PHP_EXTENSION_CALENDAR=1 \ - PHP_EXTENSION_CTYPE=1 \ - PHP_EXTENSION_CURL=1 \ - PHP_EXTENSION_DOM=1 \ - PHP_EXTENSION_EXIF=1 \ - PHP_EXTENSION_FILEINFO=1 \ - PHP_EXTENSION_FTP=1 \ - PHP_EXTENSION_GETTEXT=1 \ - PHP_EXTENSION_ICONV=1 \ - PHP_EXTENSION_JSON=1 \ - PHP_EXTENSION_MBSTRING=1 \ - PHP_EXTENSION_OPCACHE=1 \ - PHP_EXTENSION_PDO=1 \ - PHP_EXTENSION_PHAR=1 \ - PHP_EXTENSION_POSIX=1 \ - PHP_EXTENSION_READLINE=1 \ - PHP_EXTENSION_SHMOP=1 \ - PHP_EXTENSION_SIMPLEXML=1 \ - PHP_EXTENSION_SOCKETS=1 \ - PHP_EXTENSION_SYSVMSG=1 \ - PHP_EXTENSION_SYSVSEM=1 \ - PHP_EXTENSION_SYSVSHM=1 \ - PHP_EXTENSION_TOKENIZER=1 \ - PHP_EXTENSION_WDDX=1 \ - PHP_EXTENSION_XML=1 \ - PHP_EXTENSION_XMLREADER=1 \ - PHP_EXTENSION_XMLWRITER=1 \ - PHP_EXTENSION_XSL=1 \ - PHP_EXTENSION_ZIP=1 - -USER docker -RUN composer global require bamarni/symfony-console-autocomplete && \ - rm -rf ~/.composer/cache - -USER root - # Apache: built-in web server of the fpm variant (disabled by default, see PHP_FPM_WEB_SERVER) ENV APACHE_CONFDIR=/etc/apache2 @@ -366,8 +210,6 @@ COPY utils/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY utils/docker-entrypoint-as-root.sh /usr/local/bin/docker-entrypoint-as-root.sh COPY utils/supervise.sh /usr/local/bin/supervise.sh -COPY extensions/ /usr/local/lib/thecodingmachine-php/extensions -RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/Makefile b/Makefile index 6c7e0a2c..46ec6148 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ _test-prerequisites: blueprint docker pull ubuntu:20.04 test-hot: ## Test 7.4, 8.0 and 8.1 quickly - docker buildx bake --load \ + docker buildx bake \ --set "*.platform=$$(docker version -f '{{.Server.Os}}/{{.Server.Arch}}')" \ php80-slim-cli php80-cli docker run --rm -it docker.io/thecodingmachine/php:8.0-v5-cli php -v @@ -55,21 +55,21 @@ test-node: ## Test node builds only VERSION=8.4 VARIANT=cli NODE=26 $(MAKE) _test-node _test-node: _test-prerequisites ## Test node for VERSION="" and VARIANT="" - docker buildx bake --load \ + docker buildx bake \ --set "*.platform=$$(docker version -f '{{.Server.Os}}/{{.Server.Arch}}')" \ php$${VERSION//.}-$(VARIANT)-all PHP_VERSION="$(VERSION)" BRANCH=v5 VARIANT=$(VARIANT) NODE=$(NODE) ./tests-suite/bash_unit -f tap ./tests-suite/*.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT)-node$(NODE))" && exit 1) notify-send -u critical "Tests passed with success ($(VERSION)-$(VARIANT)-node$(NODE))" _test-version: _test-prerequisites ## Test php build for VERSION="" and VARIANT="" - docker buildx bake --load \ + docker buildx bake \ --set "*.platform=$$(docker version -f '{{.Server.Os}}/{{.Server.Arch}}')" \ php$${VERSION//.}-$(VARIANT)-all PHP_VERSION="$(VERSION)" BRANCH=v5 VARIANT=$(VARIANT) ./tests-suite/bash_unit -f tap ./tests-suite/*.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT))" && exit 1) notify-send -u critical "Tests passed with success ($(VERSION)-$(VARIANT))" _test-version-quick: _test-prerequisites ## Test php build for VERSION="" and VARIANT="" (without node variants) - docker buildx bake --load \ + docker buildx bake \ --set "*.platform=$$(docker version -f '{{.Server.Os}}/{{.Server.Arch}}')" \ php$${VERSION//.}-slim-$(VARIANT) php$${VERSION//.}-$(VARIANT) PHP_VERSION="$(VERSION)" BRANCH=v5 VARIANT=$(VARIANT) ./tests-suite/bash_unit -f tap ./tests-suite/*.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT))" && exit 1) @@ -80,28 +80,7 @@ clean: ## Clean dangles image after build cves: - docker build \ - --build-arg PHP_VERSION="8.4" \ - --build-arg VARIANT="apache" \ - --build-arg GLOBAL_VERSION="v5" \ - --file ./Dockerfile.slim.apache \ - --tag testv5-slim \ - . - docker --debug build \ - --build-arg PHP_VERSION="8.4" \ - --build-arg VARIANT="apache" \ - --build-arg GLOBAL_VERSION="v5" \ - --build-arg FROM_IMAGE="testv5-slim" \ - --file ./Dockerfile.apache \ - --tag testv5 \ - . - docker --debug build \ - --build-arg PHP_VERSION="8.4" \ - --build-arg VARIANT="apache-node22" \ - --build-arg NODE_VERSION="22" \ - --build-arg GLOBAL_VERSION="v5" \ - --build-arg FROM_IMAGE="testv5" \ - --file ./Dockerfile.apache.node \ - --tag testv5-node \ - . - docker scout cves testv5-node --only-fixed --locations + docker buildx bake \ + --set "*.platform=$$(docker version -f '{{.Server.Os}}/{{.Server.Arch}}')" \ + php84-apache-node22 + docker scout cves thecodingmachine/php:8.4-v5-apache-node22 --only-fixed --locations diff --git a/docker-bake.hcl b/docker-bake.hcl index 171dad41..fdaeb242 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -311,15 +311,49 @@ target "default" { ########################### ## PHP 8.5 ########################### +# Layers shared by the images of all the variants (not published) +target "php85-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "8.5" + } +} + +target "php85-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php85-base" + } +} + # thecodingmachine/php:8.5-v5-slim-apache target "php85-slim-apache" { inherits = ["default"] tags = tag("8.5", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "8.5" VARIANT = "apache" } + contexts = { + base = "target:php85-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php85-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php85-extensions" + } } # thecodingmachine/php:8.5-v5-apache @@ -328,12 +362,10 @@ target "php85-apache" { tags = tag("8.5", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "8.5" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php85-slim-apache" + slim-with-extensions = "target:php85-slim-apache-with-extensions" } } @@ -417,18 +449,30 @@ target "php85-apache-node18" { } } -########################### -## PHP 8.5 -########################### # thecodingmachine/php:8.5-v5-slim-fpm target "php85-slim-fpm" { inherits = ["default"] tags = tag("8.5", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "8.5" VARIANT = "fpm" } + contexts = { + base = "target:php85-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php85-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php85-extensions" + } } # thecodingmachine/php:8.5-v5-fpm @@ -437,12 +481,10 @@ target "php85-fpm" { tags = tag("8.5", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "8.5" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php85-slim-fpm" + slim-with-extensions = "target:php85-slim-fpm-with-extensions" } } @@ -526,18 +568,30 @@ target "php85-fpm-node18" { } } -########################### -## PHP 8.5 -########################### # thecodingmachine/php:8.5-v5-slim-cli target "php85-slim-cli" { inherits = ["default"] tags = tag("8.5", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "8.5" VARIANT = "cli" } + contexts = { + base = "target:php85-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php85-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php85-extensions" + } } # thecodingmachine/php:8.5-v5-cli @@ -546,12 +600,10 @@ target "php85-cli" { tags = tag("8.5", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "8.5" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php85-slim-cli" + slim-with-extensions = "target:php85-slim-cli-with-extensions" } } @@ -638,15 +690,49 @@ target "php85-cli-node18" { ########################### ## PHP 8.4 ########################### +# Layers shared by the images of all the variants (not published) +target "php84-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "8.4" + } +} + +target "php84-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php84-base" + } +} + # thecodingmachine/php:8.4-v5-slim-apache target "php84-slim-apache" { inherits = ["default"] tags = tag("8.4", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "8.4" VARIANT = "apache" } + contexts = { + base = "target:php84-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php84-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php84-extensions" + } } # thecodingmachine/php:8.4-v5-apache @@ -655,12 +741,10 @@ target "php84-apache" { tags = tag("8.4", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "8.4" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php84-slim-apache" + slim-with-extensions = "target:php84-slim-apache-with-extensions" } } @@ -744,18 +828,30 @@ target "php84-apache-node18" { } } -########################### -## PHP 8.4 -########################### # thecodingmachine/php:8.4-v5-slim-fpm target "php84-slim-fpm" { inherits = ["default"] tags = tag("8.4", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "8.4" VARIANT = "fpm" } + contexts = { + base = "target:php84-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php84-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php84-extensions" + } } # thecodingmachine/php:8.4-v5-fpm @@ -764,12 +860,10 @@ target "php84-fpm" { tags = tag("8.4", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "8.4" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php84-slim-fpm" + slim-with-extensions = "target:php84-slim-fpm-with-extensions" } } @@ -853,18 +947,30 @@ target "php84-fpm-node18" { } } -########################### -## PHP 8.4 -########################### # thecodingmachine/php:8.4-v5-slim-cli target "php84-slim-cli" { inherits = ["default"] tags = tag("8.4", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "8.4" VARIANT = "cli" } + contexts = { + base = "target:php84-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php84-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php84-extensions" + } } # thecodingmachine/php:8.4-v5-cli @@ -873,12 +979,10 @@ target "php84-cli" { tags = tag("8.4", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "8.4" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php84-slim-cli" + slim-with-extensions = "target:php84-slim-cli-with-extensions" } } @@ -965,15 +1069,49 @@ target "php84-cli-node18" { ########################### ## PHP 8.3 ########################### +# Layers shared by the images of all the variants (not published) +target "php83-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "8.3" + } +} + +target "php83-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php83-base" + } +} + # thecodingmachine/php:8.3-v5-slim-apache target "php83-slim-apache" { inherits = ["default"] tags = tag("8.3", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "8.3" VARIANT = "apache" } + contexts = { + base = "target:php83-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php83-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php83-extensions" + } } # thecodingmachine/php:8.3-v5-apache @@ -982,12 +1120,10 @@ target "php83-apache" { tags = tag("8.3", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "8.3" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php83-slim-apache" + slim-with-extensions = "target:php83-slim-apache-with-extensions" } } @@ -1071,18 +1207,30 @@ target "php83-apache-node18" { } } -########################### -## PHP 8.3 -########################### # thecodingmachine/php:8.3-v5-slim-fpm target "php83-slim-fpm" { inherits = ["default"] tags = tag("8.3", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "8.3" VARIANT = "fpm" } + contexts = { + base = "target:php83-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php83-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php83-extensions" + } } # thecodingmachine/php:8.3-v5-fpm @@ -1091,12 +1239,10 @@ target "php83-fpm" { tags = tag("8.3", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "8.3" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php83-slim-fpm" + slim-with-extensions = "target:php83-slim-fpm-with-extensions" } } @@ -1180,18 +1326,30 @@ target "php83-fpm-node18" { } } -########################### -## PHP 8.3 -########################### # thecodingmachine/php:8.3-v5-slim-cli target "php83-slim-cli" { inherits = ["default"] tags = tag("8.3", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "8.3" VARIANT = "cli" } + contexts = { + base = "target:php83-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php83-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php83-extensions" + } } # thecodingmachine/php:8.3-v5-cli @@ -1200,12 +1358,10 @@ target "php83-cli" { tags = tag("8.3", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "8.3" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php83-slim-cli" + slim-with-extensions = "target:php83-slim-cli-with-extensions" } } @@ -1292,15 +1448,49 @@ target "php83-cli-node18" { ########################### ## PHP 8.2 ########################### +# Layers shared by the images of all the variants (not published) +target "php82-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "8.2" + } +} + +target "php82-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php82-base" + } +} + # thecodingmachine/php:8.2-v5-slim-apache target "php82-slim-apache" { inherits = ["default"] tags = tag("8.2", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "8.2" VARIANT = "apache" } + contexts = { + base = "target:php82-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php82-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php82-extensions" + } } # thecodingmachine/php:8.2-v5-apache @@ -1309,12 +1499,10 @@ target "php82-apache" { tags = tag("8.2", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "8.2" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php82-slim-apache" + slim-with-extensions = "target:php82-slim-apache-with-extensions" } } @@ -1398,18 +1586,30 @@ target "php82-apache-node18" { } } -########################### -## PHP 8.2 -########################### # thecodingmachine/php:8.2-v5-slim-fpm target "php82-slim-fpm" { inherits = ["default"] tags = tag("8.2", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "8.2" VARIANT = "fpm" } + contexts = { + base = "target:php82-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php82-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php82-extensions" + } } # thecodingmachine/php:8.2-v5-fpm @@ -1418,12 +1618,10 @@ target "php82-fpm" { tags = tag("8.2", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "8.2" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php82-slim-fpm" + slim-with-extensions = "target:php82-slim-fpm-with-extensions" } } @@ -1507,18 +1705,30 @@ target "php82-fpm-node18" { } } -########################### -## PHP 8.2 -########################### # thecodingmachine/php:8.2-v5-slim-cli target "php82-slim-cli" { inherits = ["default"] tags = tag("8.2", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "8.2" VARIANT = "cli" } + contexts = { + base = "target:php82-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php82-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php82-extensions" + } } # thecodingmachine/php:8.2-v5-cli @@ -1527,12 +1737,10 @@ target "php82-cli" { tags = tag("8.2", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "8.2" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php82-slim-cli" + slim-with-extensions = "target:php82-slim-cli-with-extensions" } } @@ -1619,15 +1827,49 @@ target "php82-cli-node18" { ########################### ## PHP 8.1 ########################### +# Layers shared by the images of all the variants (not published) +target "php81-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "8.1" + } +} + +target "php81-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php81-base" + } +} + # thecodingmachine/php:8.1-v5-slim-apache target "php81-slim-apache" { inherits = ["default"] tags = tag("8.1", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "8.1" VARIANT = "apache" } + contexts = { + base = "target:php81-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php81-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php81-extensions" + } } # thecodingmachine/php:8.1-v5-apache @@ -1636,12 +1878,10 @@ target "php81-apache" { tags = tag("8.1", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "8.1" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php81-slim-apache" + slim-with-extensions = "target:php81-slim-apache-with-extensions" } } @@ -1725,18 +1965,30 @@ target "php81-apache-node18" { } } -########################### -## PHP 8.1 -########################### # thecodingmachine/php:8.1-v5-slim-fpm target "php81-slim-fpm" { inherits = ["default"] tags = tag("8.1", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "8.1" VARIANT = "fpm" } + contexts = { + base = "target:php81-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php81-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php81-extensions" + } } # thecodingmachine/php:8.1-v5-fpm @@ -1745,12 +1997,10 @@ target "php81-fpm" { tags = tag("8.1", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "8.1" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php81-slim-fpm" + slim-with-extensions = "target:php81-slim-fpm-with-extensions" } } @@ -1834,18 +2084,30 @@ target "php81-fpm-node18" { } } -########################### -## PHP 8.1 -########################### # thecodingmachine/php:8.1-v5-slim-cli target "php81-slim-cli" { inherits = ["default"] tags = tag("8.1", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "8.1" VARIANT = "cli" } + contexts = { + base = "target:php81-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php81-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php81-extensions" + } } # thecodingmachine/php:8.1-v5-cli @@ -1854,12 +2116,10 @@ target "php81-cli" { tags = tag("8.1", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "8.1" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php81-slim-cli" + slim-with-extensions = "target:php81-slim-cli-with-extensions" } } @@ -1946,15 +2206,49 @@ target "php81-cli-node18" { ########################### ## PHP 8.0 ########################### +# Layers shared by the images of all the variants (not published) +target "php80-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "8.0" + } +} + +target "php80-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php80-base" + } +} + # thecodingmachine/php:8.0-v5-slim-apache target "php80-slim-apache" { inherits = ["default"] tags = tag("8.0", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "8.0" VARIANT = "apache" } + contexts = { + base = "target:php80-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php80-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php80-extensions" + } } # thecodingmachine/php:8.0-v5-apache @@ -1963,12 +2257,10 @@ target "php80-apache" { tags = tag("8.0", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "8.0" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php80-slim-apache" + slim-with-extensions = "target:php80-slim-apache-with-extensions" } } @@ -2052,18 +2344,30 @@ target "php80-apache-node18" { } } -########################### -## PHP 8.0 -########################### # thecodingmachine/php:8.0-v5-slim-fpm target "php80-slim-fpm" { inherits = ["default"] tags = tag("8.0", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "8.0" VARIANT = "fpm" } + contexts = { + base = "target:php80-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php80-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php80-extensions" + } } # thecodingmachine/php:8.0-v5-fpm @@ -2072,12 +2376,10 @@ target "php80-fpm" { tags = tag("8.0", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "8.0" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php80-slim-fpm" + slim-with-extensions = "target:php80-slim-fpm-with-extensions" } } @@ -2161,18 +2463,30 @@ target "php80-fpm-node18" { } } -########################### -## PHP 8.0 -########################### # thecodingmachine/php:8.0-v5-slim-cli target "php80-slim-cli" { inherits = ["default"] tags = tag("8.0", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "8.0" VARIANT = "cli" } + contexts = { + base = "target:php80-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php80-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php80-extensions" + } } # thecodingmachine/php:8.0-v5-cli @@ -2181,12 +2495,10 @@ target "php80-cli" { tags = tag("8.0", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "8.0" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php80-slim-cli" + slim-with-extensions = "target:php80-slim-cli-with-extensions" } } @@ -2273,15 +2585,49 @@ target "php80-cli-node18" { ########################### ## PHP 7.4 ########################### +# Layers shared by the images of all the variants (not published) +target "php74-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "7.4" + } +} + +target "php74-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php74-base" + } +} + # thecodingmachine/php:7.4-v5-slim-apache target "php74-slim-apache" { inherits = ["default"] tags = tag("7.4", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { - PHP_VERSION = "7.4" VARIANT = "apache" } + contexts = { + base = "target:php74-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php74-slim-apache-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.apache" + args = { + VARIANT = "apache" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php74-extensions" + } } # thecodingmachine/php:7.4-v5-apache @@ -2290,12 +2636,10 @@ target "php74-apache" { tags = tag("7.4", "apache") dockerfile = "Dockerfile.apache" args = { - PHP_VERSION = "7.4" VARIANT = "apache" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php74-slim-apache" + slim-with-extensions = "target:php74-slim-apache-with-extensions" } } @@ -2379,18 +2723,30 @@ target "php74-apache-node18" { } } -########################### -## PHP 7.4 -########################### # thecodingmachine/php:7.4-v5-slim-fpm target "php74-slim-fpm" { inherits = ["default"] tags = tag("7.4", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { - PHP_VERSION = "7.4" VARIANT = "fpm" } + contexts = { + base = "target:php74-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php74-slim-fpm-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.fpm" + args = { + VARIANT = "fpm" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php74-extensions" + } } # thecodingmachine/php:7.4-v5-fpm @@ -2399,12 +2755,10 @@ target "php74-fpm" { tags = tag("7.4", "fpm") dockerfile = "Dockerfile.fpm" args = { - PHP_VERSION = "7.4" VARIANT = "fpm" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php74-slim-fpm" + slim-with-extensions = "target:php74-slim-fpm-with-extensions" } } @@ -2488,18 +2842,30 @@ target "php74-fpm-node18" { } } -########################### -## PHP 7.4 -########################### # thecodingmachine/php:7.4-v5-slim-cli target "php74-slim-cli" { inherits = ["default"] tags = tag("7.4", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { - PHP_VERSION = "7.4" VARIANT = "cli" } + contexts = { + base = "target:php74-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php74-slim-cli-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.cli" + args = { + VARIANT = "cli" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php74-extensions" + } } # thecodingmachine/php:7.4-v5-cli @@ -2508,12 +2874,10 @@ target "php74-cli" { tags = tag("7.4", "cli") dockerfile = "Dockerfile.cli" args = { - PHP_VERSION = "7.4" VARIANT = "cli" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php74-slim-cli" + slim-with-extensions = "target:php74-slim-cli-with-extensions" } } diff --git a/docs/contributing.md b/docs/contributing.md index 2ec34ad7..9a844b7c 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -14,6 +14,14 @@ $ make blueprint The pages of the `docs` directory are not generated: edit them directly. +The images of a PHP version share their first layers (see `utils/docker-bake.blueprint.hcl`): + +- `Dockerfile.base`: the layers common to all the images; +- `Dockerfile.slim.`: the *slim* image of the variant, built on `Dockerfile.base`; +- `Dockerfile.extensions`: the extensions, installed once for the 3 variants on `Dockerfile.base`; +- `Dockerfile.`: the *fat* image, built on `Dockerfile.slim.` applied on `Dockerfile.extensions`; +- `Dockerfile..node`: the *node* images, built on the *fat* image. + ## Building and testing The tests use [bash_unit](https://github.com/pgrange/bash_unit) (see the [test suite](../tests-suite/README.md)). @@ -31,6 +39,13 @@ To test images already built, run the test suite directly: $ PHP_VERSION=8.4 BRANCH=v5 VARIANT=apache ./tests-suite/bash_unit -f tap ./tests-suite/*.sh ``` +To run the test files of several variants in parallel, as the CI does (`TEST_JOBS` test files at the same time, 2 by +default, with one log per test file): + +```bash +$ PHP_VERSION=8.4 BRANCH=v5 VARIANTS="apache cli fpm" NODE_VERSIONS="22 24 26" ./tests-suite/run_tests.sh +``` + The variables of [`tests-suite/config`](../tests-suite/config) select the images to test, e.g. `TAG_PREFIX` (images built with `TAG_PREFIX=mytest- docker buildx bake ...`) or `PLATFORM` (e.g. `linux/arm64` with QEMU). diff --git a/orbit.yml b/orbit.yml index e299420e..e88490d4 100644 --- a/orbit.yml +++ b/orbit.yml @@ -19,6 +19,8 @@ tasks: - use: generate short: Generates all Dockerfiles and the README.md file run: + - orbit generate -f utils/Dockerfile.base.blueprint -o Dockerfile.base + - orbit generate -f utils/Dockerfile.extensions.blueprint -o Dockerfile.extensions - orbit generate -f utils/Dockerfile.slim.blueprint -o Dockerfile.slim.apache -p "variant,apache" - orbit generate -f utils/Dockerfile.slim.blueprint -o Dockerfile.slim.cli -p "variant,cli" - orbit generate -f utils/Dockerfile.slim.blueprint -o Dockerfile.slim.fpm -p "variant,fpm" diff --git a/tests-suite/run_tests.sh b/tests-suite/run_tests.sh new file mode 100755 index 00000000..3169ba95 --- /dev/null +++ b/tests-suite/run_tests.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Runs the test files for each variant of VARIANTS (and each NodeJS version of NODE_VERSIONS for variant-node.sh), +# TEST_JOBS test files at the same time, with one log per test file in LOG_DIR. +# Usage: VARIANTS="apache cli fpm" NODE_VERSIONS="22 24 26" [TEST_JOBS=2] ./tests-suite/run_tests.sh +set -u +cd "$(dirname "$0")" + +export TEST_JOBS="${TEST_JOBS:-2}" +export LOG_DIR="${LOG_DIR:-$(mktemp -d)}" +mkdir -p "${LOG_DIR}" +# Started first so that the longest test files are spread over the parallel jobs instead of ending on a single one +SLOW_TEST_FILES="tool-supercronic.sh onbuild.sh variant-fpm.sh tool-daemon.sh php-extensions.sh" + +test_units() { + local file variant node + for file in ${SLOW_TEST_FILES} $(ls *.sh | grep -vxF -f <(tr ' ' '\n' <<< "${SLOW_TEST_FILES} run_tests.sh")); do + for variant in ${VARIANTS}; do + if [[ "${file}" == "variant-node.sh" ]]; then + for node in ${NODE_VERSIONS:-}; do echo "${variant} ${file} ${node}"; done + else + echo "${variant} ${file}" + fi + done + done +} + +run_test_unit() { + local variant=$1 file=$2 node=${3:-} name start status + name="${variant}${node:+-node${node}}-${file%.sh}" + start=${SECONDS} + if (export VARIANT="${variant}"; if [[ -n "${node}" ]]; then export NODE="${node}"; fi; ./bash_unit -f tap "${file}") > "${LOG_DIR}/${name}.log" 2>&1; then + status=ok + else + status=FAILED + fi + echo "${status} ${name} $((SECONDS - start))s" +} +export -f run_test_unit + +test_units | xargs -P "${TEST_JOBS}" -L 1 bash -c 'run_test_unit "$@"' _ | tee "${LOG_DIR}/summary" + +FAILED=0 +for log in "${LOG_DIR}"/*.log; do + name=$(basename "${log}" .log) + if grep -q "^FAILED ${name} " "${LOG_DIR}/summary"; then + FAILED=1 + echo "::group::FAILED ${name}" + else + echo "::group::${name}" + fi + cat "${log}" + echo "::endgroup::" +done +if [[ "${FAILED}" == "1" ]]; then + echo "Failed test files:" + grep "^FAILED" "${LOG_DIR}/summary" +fi +exit "${FAILED}" diff --git a/utils/Dockerfile.base.blueprint b/utils/Dockerfile.base.blueprint new file mode 100644 index 00000000..9f217d9a --- /dev/null +++ b/utils/Dockerfile.base.blueprint @@ -0,0 +1,163 @@ +#syntax=docker/dockerfile-upstream:1 +FROM ubuntu:24.04 +LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Fixes some weird terminal issues such as broken clear / CTRL+L +#ENV TERM=linux + +# Ensure apt doesn't ask questions when installing stuff +ENV DEBIAN_FRONTEND=noninteractive + +ARG PHP_VERSION +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=2 + +ENV TARGETOS=${TARGETOS} +ENV TARGETARCH=${TARGETARCH} +ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV PHP_VERSION=${PHP_VERSION} + +# |-------------------------------------------------------------------------- +# | Main PHP extensions +# |-------------------------------------------------------------------------- +# | +# | Installs the main PHP extensions +# | + +# Install php an other packages +RUN apt update \ + && apt upgrade -y \ + && apt install -y --no-install-recommends curl ca-certificates \ + && curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb \ + && dpkg -i /tmp/debsuryorg-archive-keyring.deb \ + && . /etc/os-release \ + && echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/php.list \ + && apt update \ + && apt install -y --no-install-recommends \ + nano \ + sudo \ + git \ + iproute2 \ + procps \ + curl \ + unzip \ + ca-certificates \ + openssh-client \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* +# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist +RUN OPCACHE_PACKAGE="" \ + && if [ "${PHP_VERSION}" != "8.5" ]; then \ + OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \ + fi \ + && apt update \ + && apt install -y --no-install-recommends \ + php${PHP_VERSION}-cli \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-mbstring \ + ${OPCACHE_PACKAGE} \ + php${PHP_VERSION}-readline \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-zip \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# |-------------------------------------------------------------------------- +# | User +# |-------------------------------------------------------------------------- +# | +# | Define a default user with sudo rights. +# | + +RUN userdel ubuntu && rm -rf /home/ubuntu +RUN useradd -ms /bin/bash docker && adduser docker sudo +# Users in the sudoers group can sudo as root without password. +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sudo + +# |-------------------------------------------------------------------------- +# | Default php.ini file +# |-------------------------------------------------------------------------- +# | +# | For some reasons, the official image has a php.ini-production.cli file +# | but no php.ini-development.cli file. Let's create this one. +# | + +RUN cp /usr/lib/php/${PHP_VERSION}/php.ini-development /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ + sed -i 's/^disable_functions/;disable_functions/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ + sed -i 's/^memory_limit = .*/memory_limit = -1/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli + +#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-production /usr/local/etc/php/php.ini-production +#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-development /usr/local/etc/php/php.ini-development +#RUN chmod 644 /usr/local/etc/php/php.ini-* + +ENV TEMPLATE_PHP_INI=development + +# Let's remove the default CLI php.ini file (it will be copied from TEMPLATE_PHP_INI) +RUN rm /etc/php/${PHP_VERSION}/cli/php.ini + +# |-------------------------------------------------------------------------- +# | Composer +# |-------------------------------------------------------------------------- +# | +# | Installs Composer to easily manage your PHP dependencies. +# | + +#ENV COMPOSER_ALLOW_SUPERUSER 1 + +RUN curl -sS --retry 5 --retry-delay 2 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer &&\ + chmod +x /usr/local/bin/composer +COPY utils/select_composer_version.sh /usr/local/bin/select_composer_version.sh + +# TODO: utils.php in /usr/local/bin... bof! +COPY utils/utils.php /usr/local/bin/utils.php +RUN mv /usr/bin/php /usr/bin/real_php +COPY utils/php_proxy.sh /usr/bin/php +COPY utils/php_env_fingerprint.sh /usr/local/bin/php_env_fingerprint.sh +RUN touch /opt/php_env_fingerprint +COPY utils/generate_conf.php /usr/local/bin/generate_conf.php +COPY utils/setup_extensions.php /usr/local/bin/setup_extensions.php + +# |-------------------------------------------------------------------------- +# | Default PHP extensions to be enabled +# | By default, enable all the extensions that are enabled on a base Ubuntu install +# |-------------------------------------------------------------------------- +ENV PHP_EXTENSION_CALENDAR=1 \ + PHP_EXTENSION_CTYPE=1 \ + PHP_EXTENSION_CURL=1 \ + PHP_EXTENSION_DOM=1 \ + PHP_EXTENSION_EXIF=1 \ + PHP_EXTENSION_FILEINFO=1 \ + PHP_EXTENSION_FTP=1 \ + PHP_EXTENSION_GETTEXT=1 \ + PHP_EXTENSION_ICONV=1 \ + PHP_EXTENSION_JSON=1 \ + PHP_EXTENSION_MBSTRING=1 \ + PHP_EXTENSION_OPCACHE=1 \ + PHP_EXTENSION_PDO=1 \ + PHP_EXTENSION_PHAR=1 \ + PHP_EXTENSION_POSIX=1 \ + PHP_EXTENSION_READLINE=1 \ + PHP_EXTENSION_SHMOP=1 \ + PHP_EXTENSION_SIMPLEXML=1 \ + PHP_EXTENSION_SOCKETS=1 \ + PHP_EXTENSION_SYSVMSG=1 \ + PHP_EXTENSION_SYSVSEM=1 \ + PHP_EXTENSION_SYSVSHM=1 \ + PHP_EXTENSION_TOKENIZER=1 \ + PHP_EXTENSION_WDDX=1 \ + PHP_EXTENSION_XML=1 \ + PHP_EXTENSION_XMLREADER=1 \ + PHP_EXTENSION_XMLWRITER=1 \ + PHP_EXTENSION_XSL=1 \ + PHP_EXTENSION_ZIP=1 + +USER docker +RUN composer global require bamarni/symfony-console-autocomplete && \ + rm -rf ~/.composer/cache + +USER root + +COPY extensions/ /usr/local/lib/thecodingmachine-php/extensions +RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current diff --git a/utils/Dockerfile.blueprint b/utils/Dockerfile.blueprint index 42e49a30..3941c751 100644 --- a/utils/Dockerfile.blueprint +++ b/utils/Dockerfile.blueprint @@ -2,13 +2,9 @@ ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG INSTALL_LOCALES=1 -ARG PHP_VERSION="8.4" -ARG GLOBAL_VERSION="v5" -ARG REPO="thecodingmachine/php" -ARG TAG_PREFIX="" -ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-{{ .Orbit.variant }}" -FROM ${FROM_IMAGE} +# The slim Dockerfile of the variant applied on Dockerfile.extensions (see docker-bake.hcl) +FROM slim-with-extensions LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -16,15 +12,10 @@ ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=2 -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - +# The packages of the variant enable all the extensions installed before them: enable only the ones of the slim image USER root -RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh +RUN /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash && \ + cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./disable_all.sh USER docker # |-------------------------------------------------------------------------- diff --git a/utils/Dockerfile.extensions.blueprint b/utils/Dockerfile.extensions.blueprint new file mode 100644 index 00000000..5a548513 --- /dev/null +++ b/utils/Dockerfile.extensions.blueprint @@ -0,0 +1,15 @@ +#syntax=docker/dockerfile-upstream:1 +FROM base + +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=2 + +# |-------------------------------------------------------------------------- +# | Main PHP extensions +# |-------------------------------------------------------------------------- +# | +# | Installs the main PHP extensions, shared by the fat images of all the variants +# | + +RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/ && ./install_all.sh && ./disable_all.sh diff --git a/utils/Dockerfile.slim.blueprint b/utils/Dockerfile.slim.blueprint index 047e507a..e5f71de2 100644 --- a/utils/Dockerfile.slim.blueprint +++ b/utils/Dockerfile.slim.blueprint @@ -1,167 +1,11 @@ #syntax=docker/dockerfile-upstream:1 -FROM ubuntu:24.04 -LABEL authors="Mistral Oz , Julien Neuhart , David Négrier " -SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# "base" is Dockerfile.base for the slim images, Dockerfile.extensions for the fat ones (see docker-bake.hcl) +FROM base -# Fixes some weird terminal issues such as broken clear / CTRL+L -#ENV TERM=linux - -# Ensure apt doesn't ask questions when installing stuff -ENV DEBIAN_FRONTEND=noninteractive - -ARG PHP_VERSION -ARG TARGETOS -ARG TARGETARCH -ARG BLACKFIRE_VERSION=2 ONBUILD ARG TARGETOS=${TARGETOS} ONBUILD ARG TARGETARCH=${TARGETARCH} ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV TARGETOS=${TARGETOS} -ENV TARGETARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} -ENV PHP_VERSION=${PHP_VERSION} - -# |-------------------------------------------------------------------------- -# | Main PHP extensions -# |-------------------------------------------------------------------------- -# | -# | Installs the main PHP extensions -# | - -# Install php an other packages -RUN apt update \ - && apt upgrade -y \ - && apt install -y --no-install-recommends curl ca-certificates \ - && curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb \ - && dpkg -i /tmp/debsuryorg-archive-keyring.deb \ - && . /etc/os-release \ - && echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/php.list \ - && apt update \ - && apt install -y --no-install-recommends \ - nano \ - sudo \ - git \ - iproute2 \ - procps \ - curl \ - unzip \ - ca-certificates \ - openssh-client \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* -# Note: From PHP 8.5, opcache is built-in and php${PHP_VERSION}-opcache package doesn't exist -RUN OPCACHE_PACKAGE="" \ - && if [ "${PHP_VERSION}" != "8.5" ]; then \ - OPCACHE_PACKAGE="php${PHP_VERSION}-opcache"; \ - fi \ - && apt update \ - && apt install -y --no-install-recommends \ - php${PHP_VERSION}-cli \ - php${PHP_VERSION}-curl \ - php${PHP_VERSION}-mbstring \ - ${OPCACHE_PACKAGE} \ - php${PHP_VERSION}-readline \ - php${PHP_VERSION}-xml \ - php${PHP_VERSION}-zip \ - && apt clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -# |-------------------------------------------------------------------------- -# | User -# |-------------------------------------------------------------------------- -# | -# | Define a default user with sudo rights. -# | - -RUN userdel ubuntu && rm -rf /home/ubuntu -RUN useradd -ms /bin/bash docker && adduser docker sudo -# Users in the sudoers group can sudo as root without password. -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sudo - -# |-------------------------------------------------------------------------- -# | Default php.ini file -# |-------------------------------------------------------------------------- -# | -# | For some reasons, the official image has a php.ini-production.cli file -# | but no php.ini-development.cli file. Let's create this one. -# | - -RUN cp /usr/lib/php/${PHP_VERSION}/php.ini-development /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^disable_functions/;disable_functions/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli && \ - sed -i 's/^memory_limit = .*/memory_limit = -1/g' /usr/lib/php/${PHP_VERSION}/php.ini-development.cli - -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-production /usr/local/etc/php/php.ini-production -#ADD https://raw.githubusercontent.com/php/php-src/PHP-${PHP_VERSION}/php.ini-development /usr/local/etc/php/php.ini-development -#RUN chmod 644 /usr/local/etc/php/php.ini-* - -ENV TEMPLATE_PHP_INI=development - -# Let's remove the default CLI php.ini file (it will be copied from TEMPLATE_PHP_INI) -RUN rm /etc/php/${PHP_VERSION}/cli/php.ini - -# |-------------------------------------------------------------------------- -# | Composer -# |-------------------------------------------------------------------------- -# | -# | Installs Composer to easily manage your PHP dependencies. -# | - -#ENV COMPOSER_ALLOW_SUPERUSER 1 - -RUN curl -sS --retry 5 --retry-delay 2 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer &&\ - chmod +x /usr/local/bin/composer -COPY utils/select_composer_version.sh /usr/local/bin/select_composer_version.sh - -# TODO: utils.php in /usr/local/bin... bof! -COPY utils/utils.php /usr/local/bin/utils.php -RUN mv /usr/bin/php /usr/bin/real_php -COPY utils/php_proxy.sh /usr/bin/php -COPY utils/php_env_fingerprint.sh /usr/local/bin/php_env_fingerprint.sh -RUN touch /opt/php_env_fingerprint -COPY utils/generate_conf.php /usr/local/bin/generate_conf.php -COPY utils/setup_extensions.php /usr/local/bin/setup_extensions.php - -# |-------------------------------------------------------------------------- -# | Default PHP extensions to be enabled -# | By default, enable all the extensions that are enabled on a base Ubuntu install -# |-------------------------------------------------------------------------- -ENV PHP_EXTENSION_CALENDAR=1 \ - PHP_EXTENSION_CTYPE=1 \ - PHP_EXTENSION_CURL=1 \ - PHP_EXTENSION_DOM=1 \ - PHP_EXTENSION_EXIF=1 \ - PHP_EXTENSION_FILEINFO=1 \ - PHP_EXTENSION_FTP=1 \ - PHP_EXTENSION_GETTEXT=1 \ - PHP_EXTENSION_ICONV=1 \ - PHP_EXTENSION_JSON=1 \ - PHP_EXTENSION_MBSTRING=1 \ - PHP_EXTENSION_OPCACHE=1 \ - PHP_EXTENSION_PDO=1 \ - PHP_EXTENSION_PHAR=1 \ - PHP_EXTENSION_POSIX=1 \ - PHP_EXTENSION_READLINE=1 \ - PHP_EXTENSION_SHMOP=1 \ - PHP_EXTENSION_SIMPLEXML=1 \ - PHP_EXTENSION_SOCKETS=1 \ - PHP_EXTENSION_SYSVMSG=1 \ - PHP_EXTENSION_SYSVSEM=1 \ - PHP_EXTENSION_SYSVSHM=1 \ - PHP_EXTENSION_TOKENIZER=1 \ - PHP_EXTENSION_WDDX=1 \ - PHP_EXTENSION_XML=1 \ - PHP_EXTENSION_XMLREADER=1 \ - PHP_EXTENSION_XMLWRITER=1 \ - PHP_EXTENSION_XSL=1 \ - PHP_EXTENSION_ZIP=1 - -USER docker -RUN composer global require bamarni/symfony-console-autocomplete && \ - rm -rf ~/.composer/cache - -USER root - {{if or (eq .Orbit.variant "apache") (eq .Orbit.variant "fpm") }} # Apache: built-in web server of the fpm variant (disabled by default, see PHP_FPM_WEB_SERVER) ENV APACHE_CONFDIR=/etc/apache2 @@ -386,8 +230,6 @@ COPY utils/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY utils/docker-entrypoint-as-root.sh /usr/local/bin/docker-entrypoint-as-root.sh COPY utils/supervise.sh /usr/local/bin/supervise.sh -COPY extensions/ /usr/local/lib/thecodingmachine-php/extensions -RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] diff --git a/utils/docker-bake.blueprint.hcl b/utils/docker-bake.blueprint.hcl index 0f1aa89b..39f4369e 100644 --- a/utils/docker-bake.blueprint.hcl +++ b/utils/docker-bake.blueprint.hcl @@ -54,19 +54,53 @@ target "default" { output = ["type=docker"] # export in local docker } -{{range $phpV := $versions}}{{range $variant := $variants}}{{ $nodes := $legacyNodeVersions }} +{{range $phpV := $versions}} ########################### ## PHP {{ $phpV }} ########################### +# Layers shared by the images of all the variants (not published) +target "php{{ $phpV | replace "." "" }}-base" { + inherits = ["default"] + dockerfile = "Dockerfile.base" + output = ["type=cacheonly"] + args = { + PHP_VERSION = "{{ $phpV }}" + } +} + +target "php{{ $phpV | replace "." "" }}-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.extensions" + output = ["type=cacheonly"] + contexts = { + base = "target:php{{ $phpV | replace "." "" }}-base" + } +} +{{range $variant := $variants}}{{ $nodes := $legacyNodeVersions }} # thecodingmachine/php:{{ $phpV }}-v5-slim-{{ $variant }} target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" { inherits = ["default"] tags = tag("{{ $phpV }}", "slim-{{ $variant }}") dockerfile = "Dockerfile.slim.{{ $variant }}" args = { - PHP_VERSION = "{{ $phpV }}" VARIANT = "{{ $variant }}" } + contexts = { + base = "target:php{{ $phpV | replace "." "" }}-base" + } +} + +# The slim image of the variant with the extensions (not published) +target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}-with-extensions" { + inherits = ["default"] + dockerfile = "Dockerfile.slim.{{ $variant }}" + args = { + VARIANT = "{{ $variant }}" + } + output = ["type=cacheonly"] + contexts = { + base = "target:php{{ $phpV | replace "." "" }}-extensions" + } } # thecodingmachine/php:{{ $phpV }}-v5-{{ $variant }} @@ -75,12 +109,10 @@ target "php{{ $phpV | replace "." "" }}-{{ $variant }}" { tags = tag("{{ $phpV }}", "{{ $variant }}") dockerfile = "Dockerfile.{{ $variant }}" args = { - PHP_VERSION = "{{ $phpV }}" VARIANT = "{{ $variant }}" - FROM_IMAGE = "slim" } contexts = { - slim = "target:php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" + slim-with-extensions = "target:php{{ $phpV | replace "." "" }}-slim-{{ $variant }}-with-extensions" } } {{range $nodeV := $nodes}} From ce1e33070e6871a0825455bcd6e70e0ec655b0a3 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 5 Nov 2026 15:06:41 +0100 Subject: [PATCH 4/6] Push the images of a job 4 at a time, with retries A job publishes the 15 images of a PHP version and an architecture: pushing them one by one took about 3 minutes. --- .github/workflows/workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ed144a2f..de5f5065 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -68,7 +68,8 @@ jobs: docker buildx bake \ --print --progress=quiet \ php${PHP_VERSION//.} | jq -r '.target[].tags // [] | .[]'); - for TAG in $TAGS; do docker push --quiet ${TAG}; done; + # 4 images at the same time, with retries: ghcr.io sometimes answers "unknown blob" + printf '%s\n' $TAGS | xargs -P 4 -I {} bash -c 'for i in 1 2 3; do docker push --quiet "{}" && exit 0; sleep 5; done; exit 1' merge-and-publish: if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} From 3573af37bf05d82e15fa84c7bc5ffb05707ca2ac Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 5 Nov 2026 20:39:35 +0100 Subject: [PATCH 5/6] Reuse the layers of the previous runs of v5, from an empty cache each week The runs of v5 read and write the layers in a registry (ghcr.io//php-cache): a push or a manual run only rebuilds what changed. A separate workflow deletes the versions of the cache each week, 30 minutes before the scheduled run of v5 (or when run manually), so that the images take the updates of the packages each week. The pull requests only read the cache of v5, which no pull request can write. The GitHub Actions cache is not used: limited to 10 GB, and slow to write by 8 jobs at the same time. BuildKit 0.34 does not find in the cache the layers of a target built from another target (contexts = target:...) with a new builder, as on GitHub: the builder uses BuildKit 0.35. --- .github/workflows/purge-cache.yml | 31 +++ .github/workflows/workflow.yml | 6 + docker-bake.hcl | 379 ++++++++++++++++++++++++++++++ utils/docker-bake.blueprint.hcl | 27 +++ 4 files changed, 443 insertions(+) create mode 100644 .github/workflows/purge-cache.yml diff --git a/.github/workflows/purge-cache.yml b/.github/workflows/purge-cache.yml new file mode 100644 index 00000000..39f97b61 --- /dev/null +++ b/.github/workflows/purge-cache.yml @@ -0,0 +1,31 @@ +name: Purge the cache of the layers + +# Runs before the weekly build of v5, so that it starts from an empty cache and takes the updates of the packages +on: + schedule: + - cron: '12 3 * * 0' + workflow_dispatch: + +jobs: + purge-cache: + runs-on: ubuntu-24.04 + permissions: + packages: write + steps: + - name: Login to GHCR + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Delete the versions of the cache + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + CACHE_REPO="ghcr.io/${{ github.repository_owner }}/php-cache" + # GitHub refuses to delete the last version of a package: the "keep" tag (an empty image) stays + docker buildx imagetools create -t "${CACHE_REPO}:keep" docker.io/library/hello-world:latest + OWNER_TYPE=$(gh api "users/${{ github.repository_owner }}" --jq 'if .type == "Organization" then "orgs" else "users" end') + VERSIONS="${OWNER_TYPE}/${{ github.repository_owner }}/packages/container/php-cache/versions" + gh api --paginate "${VERSIONS}" --jq '.[] | select(.metadata.container.tags | index("keep") | not) | .id' \ + | xargs -r -I {} gh api --silent -X DELETE "${VERSIONS}/{}" diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index de5f5065..9d3ec05a 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -31,9 +31,15 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 + with: + # The layers of the targets built from another target are only found in the registry cache from BuildKit 0.35 + driver-opts: image=moby/buildkit:v0.35.0-rc1 - name: Build run: | PHP_VERSION="${{ matrix.php_version }}" + # The pull requests only read the cache of v5 + CACHE_REPO="ghcr.io/${{ github.repository_owner }}/php-cache" \ + CACHE_WRITE="${{ github.event_name != 'pull_request' && '1' || '0' }}" \ REPO="ghcr.io/${{ github.repository_owner }}/php" \ ARCH_SUFFIX="-${{ matrix.builder.arch }}" \ TAG_PREFIX="rc${GITHUB_RUN_ID}-" \ diff --git a/docker-bake.hcl b/docker-bake.hcl index fdaeb242..bf8a167c 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -287,6 +287,21 @@ variable "IS_RELEASE" {default = "0"} variable "GLOBAL_VERSION" {default = "v5"} variable "ARCH_SUFFIX" {default = ""} +# Registry of the cache of the layers between the runs (e.g. ghcr.io/thecodingmachine/php-cache), none by default. +# The cache is only read, unless CACHE_WRITE=1 +variable "CACHE_REPO" {default = ""} +variable "CACHE_WRITE" {default = "0"} + +function "cache_from" { + params = [NAME] + result = equal("", CACHE_REPO) ? [] : ["type=registry,ref=${CACHE_REPO}:${NAME}${ARCH_SUFFIX}"] +} + +function "cache_to" { + params = [NAME] + result = equal("", CACHE_REPO) || !equal("1", CACHE_WRITE) ? [] : ["type=registry,ref=${CACHE_REPO}:${NAME}${ARCH_SUFFIX},mode=max,image-manifest=true,oci-mediatypes=true,ignore-error=true"] +} + function "tag" { params = [PHP_VERSION, VARIANT] result = [ @@ -314,6 +329,8 @@ target "default" { # Layers shared by the images of all the variants (not published) target "php85-base" { inherits = ["default"] + cache-from = cache_from("php85-base") + cache-to = cache_to("php85-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -323,6 +340,8 @@ target "php85-base" { target "php85-extensions" { inherits = ["default"] + cache-from = cache_from("php85-extensions") + cache-to = cache_to("php85-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -333,6 +352,8 @@ target "php85-extensions" { # thecodingmachine/php:8.5-v5-slim-apache target "php85-slim-apache" { inherits = ["default"] + cache-from = cache_from("php85-slim-apache") + cache-to = cache_to("php85-slim-apache") tags = tag("8.5", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -346,6 +367,8 @@ target "php85-slim-apache" { # The slim image of the variant with the extensions (not published) target "php85-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php85-slim-apache-with-extensions") + cache-to = cache_to("php85-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -359,6 +382,8 @@ target "php85-slim-apache-with-extensions" { # thecodingmachine/php:8.5-v5-apache target "php85-apache" { inherits = ["default"] + cache-from = cache_from("php85-apache") + cache-to = cache_to("php85-apache") tags = tag("8.5", "apache") dockerfile = "Dockerfile.apache" args = { @@ -372,6 +397,8 @@ target "php85-apache" { # thecodingmachine/php:8.5-v5-apache-node26 target "php85-apache-node26" { inherits = ["default"] + cache-from = cache_from("php85-apache-node26") + cache-to = cache_to("php85-apache-node26") tags = tag("8.5", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -388,6 +415,8 @@ target "php85-apache-node26" { # thecodingmachine/php:8.5-v5-apache-node24 target "php85-apache-node24" { inherits = ["default"] + cache-from = cache_from("php85-apache-node24") + cache-to = cache_to("php85-apache-node24") tags = tag("8.5", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -404,6 +433,8 @@ target "php85-apache-node24" { # thecodingmachine/php:8.5-v5-apache-node22 target "php85-apache-node22" { inherits = ["default"] + cache-from = cache_from("php85-apache-node22") + cache-to = cache_to("php85-apache-node22") tags = tag("8.5", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -420,6 +451,8 @@ target "php85-apache-node22" { # thecodingmachine/php:8.5-v5-apache-node20 target "php85-apache-node20" { inherits = ["default"] + cache-from = cache_from("php85-apache-node20") + cache-to = cache_to("php85-apache-node20") tags = tag("8.5", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -436,6 +469,8 @@ target "php85-apache-node20" { # thecodingmachine/php:8.5-v5-apache-node18 target "php85-apache-node18" { inherits = ["default"] + cache-from = cache_from("php85-apache-node18") + cache-to = cache_to("php85-apache-node18") tags = tag("8.5", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -452,6 +487,8 @@ target "php85-apache-node18" { # thecodingmachine/php:8.5-v5-slim-fpm target "php85-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php85-slim-fpm") + cache-to = cache_to("php85-slim-fpm") tags = tag("8.5", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -465,6 +502,8 @@ target "php85-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php85-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php85-slim-fpm-with-extensions") + cache-to = cache_to("php85-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -478,6 +517,8 @@ target "php85-slim-fpm-with-extensions" { # thecodingmachine/php:8.5-v5-fpm target "php85-fpm" { inherits = ["default"] + cache-from = cache_from("php85-fpm") + cache-to = cache_to("php85-fpm") tags = tag("8.5", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -491,6 +532,8 @@ target "php85-fpm" { # thecodingmachine/php:8.5-v5-fpm-node26 target "php85-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php85-fpm-node26") + cache-to = cache_to("php85-fpm-node26") tags = tag("8.5", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -507,6 +550,8 @@ target "php85-fpm-node26" { # thecodingmachine/php:8.5-v5-fpm-node24 target "php85-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php85-fpm-node24") + cache-to = cache_to("php85-fpm-node24") tags = tag("8.5", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -523,6 +568,8 @@ target "php85-fpm-node24" { # thecodingmachine/php:8.5-v5-fpm-node22 target "php85-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php85-fpm-node22") + cache-to = cache_to("php85-fpm-node22") tags = tag("8.5", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -539,6 +586,8 @@ target "php85-fpm-node22" { # thecodingmachine/php:8.5-v5-fpm-node20 target "php85-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php85-fpm-node20") + cache-to = cache_to("php85-fpm-node20") tags = tag("8.5", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -555,6 +604,8 @@ target "php85-fpm-node20" { # thecodingmachine/php:8.5-v5-fpm-node18 target "php85-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php85-fpm-node18") + cache-to = cache_to("php85-fpm-node18") tags = tag("8.5", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -571,6 +622,8 @@ target "php85-fpm-node18" { # thecodingmachine/php:8.5-v5-slim-cli target "php85-slim-cli" { inherits = ["default"] + cache-from = cache_from("php85-slim-cli") + cache-to = cache_to("php85-slim-cli") tags = tag("8.5", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -584,6 +637,8 @@ target "php85-slim-cli" { # The slim image of the variant with the extensions (not published) target "php85-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php85-slim-cli-with-extensions") + cache-to = cache_to("php85-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -597,6 +652,8 @@ target "php85-slim-cli-with-extensions" { # thecodingmachine/php:8.5-v5-cli target "php85-cli" { inherits = ["default"] + cache-from = cache_from("php85-cli") + cache-to = cache_to("php85-cli") tags = tag("8.5", "cli") dockerfile = "Dockerfile.cli" args = { @@ -610,6 +667,8 @@ target "php85-cli" { # thecodingmachine/php:8.5-v5-cli-node26 target "php85-cli-node26" { inherits = ["default"] + cache-from = cache_from("php85-cli-node26") + cache-to = cache_to("php85-cli-node26") tags = tag("8.5", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -626,6 +685,8 @@ target "php85-cli-node26" { # thecodingmachine/php:8.5-v5-cli-node24 target "php85-cli-node24" { inherits = ["default"] + cache-from = cache_from("php85-cli-node24") + cache-to = cache_to("php85-cli-node24") tags = tag("8.5", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -642,6 +703,8 @@ target "php85-cli-node24" { # thecodingmachine/php:8.5-v5-cli-node22 target "php85-cli-node22" { inherits = ["default"] + cache-from = cache_from("php85-cli-node22") + cache-to = cache_to("php85-cli-node22") tags = tag("8.5", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -658,6 +721,8 @@ target "php85-cli-node22" { # thecodingmachine/php:8.5-v5-cli-node20 target "php85-cli-node20" { inherits = ["default"] + cache-from = cache_from("php85-cli-node20") + cache-to = cache_to("php85-cli-node20") tags = tag("8.5", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -674,6 +739,8 @@ target "php85-cli-node20" { # thecodingmachine/php:8.5-v5-cli-node18 target "php85-cli-node18" { inherits = ["default"] + cache-from = cache_from("php85-cli-node18") + cache-to = cache_to("php85-cli-node18") tags = tag("8.5", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { @@ -693,6 +760,8 @@ target "php85-cli-node18" { # Layers shared by the images of all the variants (not published) target "php84-base" { inherits = ["default"] + cache-from = cache_from("php84-base") + cache-to = cache_to("php84-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -702,6 +771,8 @@ target "php84-base" { target "php84-extensions" { inherits = ["default"] + cache-from = cache_from("php84-extensions") + cache-to = cache_to("php84-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -712,6 +783,8 @@ target "php84-extensions" { # thecodingmachine/php:8.4-v5-slim-apache target "php84-slim-apache" { inherits = ["default"] + cache-from = cache_from("php84-slim-apache") + cache-to = cache_to("php84-slim-apache") tags = tag("8.4", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -725,6 +798,8 @@ target "php84-slim-apache" { # The slim image of the variant with the extensions (not published) target "php84-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php84-slim-apache-with-extensions") + cache-to = cache_to("php84-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -738,6 +813,8 @@ target "php84-slim-apache-with-extensions" { # thecodingmachine/php:8.4-v5-apache target "php84-apache" { inherits = ["default"] + cache-from = cache_from("php84-apache") + cache-to = cache_to("php84-apache") tags = tag("8.4", "apache") dockerfile = "Dockerfile.apache" args = { @@ -751,6 +828,8 @@ target "php84-apache" { # thecodingmachine/php:8.4-v5-apache-node26 target "php84-apache-node26" { inherits = ["default"] + cache-from = cache_from("php84-apache-node26") + cache-to = cache_to("php84-apache-node26") tags = tag("8.4", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -767,6 +846,8 @@ target "php84-apache-node26" { # thecodingmachine/php:8.4-v5-apache-node24 target "php84-apache-node24" { inherits = ["default"] + cache-from = cache_from("php84-apache-node24") + cache-to = cache_to("php84-apache-node24") tags = tag("8.4", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -783,6 +864,8 @@ target "php84-apache-node24" { # thecodingmachine/php:8.4-v5-apache-node22 target "php84-apache-node22" { inherits = ["default"] + cache-from = cache_from("php84-apache-node22") + cache-to = cache_to("php84-apache-node22") tags = tag("8.4", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -799,6 +882,8 @@ target "php84-apache-node22" { # thecodingmachine/php:8.4-v5-apache-node20 target "php84-apache-node20" { inherits = ["default"] + cache-from = cache_from("php84-apache-node20") + cache-to = cache_to("php84-apache-node20") tags = tag("8.4", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -815,6 +900,8 @@ target "php84-apache-node20" { # thecodingmachine/php:8.4-v5-apache-node18 target "php84-apache-node18" { inherits = ["default"] + cache-from = cache_from("php84-apache-node18") + cache-to = cache_to("php84-apache-node18") tags = tag("8.4", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -831,6 +918,8 @@ target "php84-apache-node18" { # thecodingmachine/php:8.4-v5-slim-fpm target "php84-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php84-slim-fpm") + cache-to = cache_to("php84-slim-fpm") tags = tag("8.4", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -844,6 +933,8 @@ target "php84-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php84-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php84-slim-fpm-with-extensions") + cache-to = cache_to("php84-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -857,6 +948,8 @@ target "php84-slim-fpm-with-extensions" { # thecodingmachine/php:8.4-v5-fpm target "php84-fpm" { inherits = ["default"] + cache-from = cache_from("php84-fpm") + cache-to = cache_to("php84-fpm") tags = tag("8.4", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -870,6 +963,8 @@ target "php84-fpm" { # thecodingmachine/php:8.4-v5-fpm-node26 target "php84-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php84-fpm-node26") + cache-to = cache_to("php84-fpm-node26") tags = tag("8.4", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -886,6 +981,8 @@ target "php84-fpm-node26" { # thecodingmachine/php:8.4-v5-fpm-node24 target "php84-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php84-fpm-node24") + cache-to = cache_to("php84-fpm-node24") tags = tag("8.4", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -902,6 +999,8 @@ target "php84-fpm-node24" { # thecodingmachine/php:8.4-v5-fpm-node22 target "php84-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php84-fpm-node22") + cache-to = cache_to("php84-fpm-node22") tags = tag("8.4", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -918,6 +1017,8 @@ target "php84-fpm-node22" { # thecodingmachine/php:8.4-v5-fpm-node20 target "php84-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php84-fpm-node20") + cache-to = cache_to("php84-fpm-node20") tags = tag("8.4", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -934,6 +1035,8 @@ target "php84-fpm-node20" { # thecodingmachine/php:8.4-v5-fpm-node18 target "php84-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php84-fpm-node18") + cache-to = cache_to("php84-fpm-node18") tags = tag("8.4", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -950,6 +1053,8 @@ target "php84-fpm-node18" { # thecodingmachine/php:8.4-v5-slim-cli target "php84-slim-cli" { inherits = ["default"] + cache-from = cache_from("php84-slim-cli") + cache-to = cache_to("php84-slim-cli") tags = tag("8.4", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -963,6 +1068,8 @@ target "php84-slim-cli" { # The slim image of the variant with the extensions (not published) target "php84-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php84-slim-cli-with-extensions") + cache-to = cache_to("php84-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -976,6 +1083,8 @@ target "php84-slim-cli-with-extensions" { # thecodingmachine/php:8.4-v5-cli target "php84-cli" { inherits = ["default"] + cache-from = cache_from("php84-cli") + cache-to = cache_to("php84-cli") tags = tag("8.4", "cli") dockerfile = "Dockerfile.cli" args = { @@ -989,6 +1098,8 @@ target "php84-cli" { # thecodingmachine/php:8.4-v5-cli-node26 target "php84-cli-node26" { inherits = ["default"] + cache-from = cache_from("php84-cli-node26") + cache-to = cache_to("php84-cli-node26") tags = tag("8.4", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -1005,6 +1116,8 @@ target "php84-cli-node26" { # thecodingmachine/php:8.4-v5-cli-node24 target "php84-cli-node24" { inherits = ["default"] + cache-from = cache_from("php84-cli-node24") + cache-to = cache_to("php84-cli-node24") tags = tag("8.4", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -1021,6 +1134,8 @@ target "php84-cli-node24" { # thecodingmachine/php:8.4-v5-cli-node22 target "php84-cli-node22" { inherits = ["default"] + cache-from = cache_from("php84-cli-node22") + cache-to = cache_to("php84-cli-node22") tags = tag("8.4", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -1037,6 +1152,8 @@ target "php84-cli-node22" { # thecodingmachine/php:8.4-v5-cli-node20 target "php84-cli-node20" { inherits = ["default"] + cache-from = cache_from("php84-cli-node20") + cache-to = cache_to("php84-cli-node20") tags = tag("8.4", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -1053,6 +1170,8 @@ target "php84-cli-node20" { # thecodingmachine/php:8.4-v5-cli-node18 target "php84-cli-node18" { inherits = ["default"] + cache-from = cache_from("php84-cli-node18") + cache-to = cache_to("php84-cli-node18") tags = tag("8.4", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { @@ -1072,6 +1191,8 @@ target "php84-cli-node18" { # Layers shared by the images of all the variants (not published) target "php83-base" { inherits = ["default"] + cache-from = cache_from("php83-base") + cache-to = cache_to("php83-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -1081,6 +1202,8 @@ target "php83-base" { target "php83-extensions" { inherits = ["default"] + cache-from = cache_from("php83-extensions") + cache-to = cache_to("php83-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -1091,6 +1214,8 @@ target "php83-extensions" { # thecodingmachine/php:8.3-v5-slim-apache target "php83-slim-apache" { inherits = ["default"] + cache-from = cache_from("php83-slim-apache") + cache-to = cache_to("php83-slim-apache") tags = tag("8.3", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -1104,6 +1229,8 @@ target "php83-slim-apache" { # The slim image of the variant with the extensions (not published) target "php83-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php83-slim-apache-with-extensions") + cache-to = cache_to("php83-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -1117,6 +1244,8 @@ target "php83-slim-apache-with-extensions" { # thecodingmachine/php:8.3-v5-apache target "php83-apache" { inherits = ["default"] + cache-from = cache_from("php83-apache") + cache-to = cache_to("php83-apache") tags = tag("8.3", "apache") dockerfile = "Dockerfile.apache" args = { @@ -1130,6 +1259,8 @@ target "php83-apache" { # thecodingmachine/php:8.3-v5-apache-node26 target "php83-apache-node26" { inherits = ["default"] + cache-from = cache_from("php83-apache-node26") + cache-to = cache_to("php83-apache-node26") tags = tag("8.3", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -1146,6 +1277,8 @@ target "php83-apache-node26" { # thecodingmachine/php:8.3-v5-apache-node24 target "php83-apache-node24" { inherits = ["default"] + cache-from = cache_from("php83-apache-node24") + cache-to = cache_to("php83-apache-node24") tags = tag("8.3", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -1162,6 +1295,8 @@ target "php83-apache-node24" { # thecodingmachine/php:8.3-v5-apache-node22 target "php83-apache-node22" { inherits = ["default"] + cache-from = cache_from("php83-apache-node22") + cache-to = cache_to("php83-apache-node22") tags = tag("8.3", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -1178,6 +1313,8 @@ target "php83-apache-node22" { # thecodingmachine/php:8.3-v5-apache-node20 target "php83-apache-node20" { inherits = ["default"] + cache-from = cache_from("php83-apache-node20") + cache-to = cache_to("php83-apache-node20") tags = tag("8.3", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -1194,6 +1331,8 @@ target "php83-apache-node20" { # thecodingmachine/php:8.3-v5-apache-node18 target "php83-apache-node18" { inherits = ["default"] + cache-from = cache_from("php83-apache-node18") + cache-to = cache_to("php83-apache-node18") tags = tag("8.3", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -1210,6 +1349,8 @@ target "php83-apache-node18" { # thecodingmachine/php:8.3-v5-slim-fpm target "php83-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php83-slim-fpm") + cache-to = cache_to("php83-slim-fpm") tags = tag("8.3", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -1223,6 +1364,8 @@ target "php83-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php83-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php83-slim-fpm-with-extensions") + cache-to = cache_to("php83-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -1236,6 +1379,8 @@ target "php83-slim-fpm-with-extensions" { # thecodingmachine/php:8.3-v5-fpm target "php83-fpm" { inherits = ["default"] + cache-from = cache_from("php83-fpm") + cache-to = cache_to("php83-fpm") tags = tag("8.3", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -1249,6 +1394,8 @@ target "php83-fpm" { # thecodingmachine/php:8.3-v5-fpm-node26 target "php83-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php83-fpm-node26") + cache-to = cache_to("php83-fpm-node26") tags = tag("8.3", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -1265,6 +1412,8 @@ target "php83-fpm-node26" { # thecodingmachine/php:8.3-v5-fpm-node24 target "php83-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php83-fpm-node24") + cache-to = cache_to("php83-fpm-node24") tags = tag("8.3", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -1281,6 +1430,8 @@ target "php83-fpm-node24" { # thecodingmachine/php:8.3-v5-fpm-node22 target "php83-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php83-fpm-node22") + cache-to = cache_to("php83-fpm-node22") tags = tag("8.3", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -1297,6 +1448,8 @@ target "php83-fpm-node22" { # thecodingmachine/php:8.3-v5-fpm-node20 target "php83-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php83-fpm-node20") + cache-to = cache_to("php83-fpm-node20") tags = tag("8.3", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -1313,6 +1466,8 @@ target "php83-fpm-node20" { # thecodingmachine/php:8.3-v5-fpm-node18 target "php83-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php83-fpm-node18") + cache-to = cache_to("php83-fpm-node18") tags = tag("8.3", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -1329,6 +1484,8 @@ target "php83-fpm-node18" { # thecodingmachine/php:8.3-v5-slim-cli target "php83-slim-cli" { inherits = ["default"] + cache-from = cache_from("php83-slim-cli") + cache-to = cache_to("php83-slim-cli") tags = tag("8.3", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -1342,6 +1499,8 @@ target "php83-slim-cli" { # The slim image of the variant with the extensions (not published) target "php83-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php83-slim-cli-with-extensions") + cache-to = cache_to("php83-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -1355,6 +1514,8 @@ target "php83-slim-cli-with-extensions" { # thecodingmachine/php:8.3-v5-cli target "php83-cli" { inherits = ["default"] + cache-from = cache_from("php83-cli") + cache-to = cache_to("php83-cli") tags = tag("8.3", "cli") dockerfile = "Dockerfile.cli" args = { @@ -1368,6 +1529,8 @@ target "php83-cli" { # thecodingmachine/php:8.3-v5-cli-node26 target "php83-cli-node26" { inherits = ["default"] + cache-from = cache_from("php83-cli-node26") + cache-to = cache_to("php83-cli-node26") tags = tag("8.3", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -1384,6 +1547,8 @@ target "php83-cli-node26" { # thecodingmachine/php:8.3-v5-cli-node24 target "php83-cli-node24" { inherits = ["default"] + cache-from = cache_from("php83-cli-node24") + cache-to = cache_to("php83-cli-node24") tags = tag("8.3", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -1400,6 +1565,8 @@ target "php83-cli-node24" { # thecodingmachine/php:8.3-v5-cli-node22 target "php83-cli-node22" { inherits = ["default"] + cache-from = cache_from("php83-cli-node22") + cache-to = cache_to("php83-cli-node22") tags = tag("8.3", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -1416,6 +1583,8 @@ target "php83-cli-node22" { # thecodingmachine/php:8.3-v5-cli-node20 target "php83-cli-node20" { inherits = ["default"] + cache-from = cache_from("php83-cli-node20") + cache-to = cache_to("php83-cli-node20") tags = tag("8.3", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -1432,6 +1601,8 @@ target "php83-cli-node20" { # thecodingmachine/php:8.3-v5-cli-node18 target "php83-cli-node18" { inherits = ["default"] + cache-from = cache_from("php83-cli-node18") + cache-to = cache_to("php83-cli-node18") tags = tag("8.3", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { @@ -1451,6 +1622,8 @@ target "php83-cli-node18" { # Layers shared by the images of all the variants (not published) target "php82-base" { inherits = ["default"] + cache-from = cache_from("php82-base") + cache-to = cache_to("php82-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -1460,6 +1633,8 @@ target "php82-base" { target "php82-extensions" { inherits = ["default"] + cache-from = cache_from("php82-extensions") + cache-to = cache_to("php82-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -1470,6 +1645,8 @@ target "php82-extensions" { # thecodingmachine/php:8.2-v5-slim-apache target "php82-slim-apache" { inherits = ["default"] + cache-from = cache_from("php82-slim-apache") + cache-to = cache_to("php82-slim-apache") tags = tag("8.2", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -1483,6 +1660,8 @@ target "php82-slim-apache" { # The slim image of the variant with the extensions (not published) target "php82-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php82-slim-apache-with-extensions") + cache-to = cache_to("php82-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -1496,6 +1675,8 @@ target "php82-slim-apache-with-extensions" { # thecodingmachine/php:8.2-v5-apache target "php82-apache" { inherits = ["default"] + cache-from = cache_from("php82-apache") + cache-to = cache_to("php82-apache") tags = tag("8.2", "apache") dockerfile = "Dockerfile.apache" args = { @@ -1509,6 +1690,8 @@ target "php82-apache" { # thecodingmachine/php:8.2-v5-apache-node26 target "php82-apache-node26" { inherits = ["default"] + cache-from = cache_from("php82-apache-node26") + cache-to = cache_to("php82-apache-node26") tags = tag("8.2", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -1525,6 +1708,8 @@ target "php82-apache-node26" { # thecodingmachine/php:8.2-v5-apache-node24 target "php82-apache-node24" { inherits = ["default"] + cache-from = cache_from("php82-apache-node24") + cache-to = cache_to("php82-apache-node24") tags = tag("8.2", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -1541,6 +1726,8 @@ target "php82-apache-node24" { # thecodingmachine/php:8.2-v5-apache-node22 target "php82-apache-node22" { inherits = ["default"] + cache-from = cache_from("php82-apache-node22") + cache-to = cache_to("php82-apache-node22") tags = tag("8.2", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -1557,6 +1744,8 @@ target "php82-apache-node22" { # thecodingmachine/php:8.2-v5-apache-node20 target "php82-apache-node20" { inherits = ["default"] + cache-from = cache_from("php82-apache-node20") + cache-to = cache_to("php82-apache-node20") tags = tag("8.2", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -1573,6 +1762,8 @@ target "php82-apache-node20" { # thecodingmachine/php:8.2-v5-apache-node18 target "php82-apache-node18" { inherits = ["default"] + cache-from = cache_from("php82-apache-node18") + cache-to = cache_to("php82-apache-node18") tags = tag("8.2", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -1589,6 +1780,8 @@ target "php82-apache-node18" { # thecodingmachine/php:8.2-v5-slim-fpm target "php82-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php82-slim-fpm") + cache-to = cache_to("php82-slim-fpm") tags = tag("8.2", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -1602,6 +1795,8 @@ target "php82-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php82-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php82-slim-fpm-with-extensions") + cache-to = cache_to("php82-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -1615,6 +1810,8 @@ target "php82-slim-fpm-with-extensions" { # thecodingmachine/php:8.2-v5-fpm target "php82-fpm" { inherits = ["default"] + cache-from = cache_from("php82-fpm") + cache-to = cache_to("php82-fpm") tags = tag("8.2", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -1628,6 +1825,8 @@ target "php82-fpm" { # thecodingmachine/php:8.2-v5-fpm-node26 target "php82-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php82-fpm-node26") + cache-to = cache_to("php82-fpm-node26") tags = tag("8.2", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -1644,6 +1843,8 @@ target "php82-fpm-node26" { # thecodingmachine/php:8.2-v5-fpm-node24 target "php82-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php82-fpm-node24") + cache-to = cache_to("php82-fpm-node24") tags = tag("8.2", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -1660,6 +1861,8 @@ target "php82-fpm-node24" { # thecodingmachine/php:8.2-v5-fpm-node22 target "php82-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php82-fpm-node22") + cache-to = cache_to("php82-fpm-node22") tags = tag("8.2", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -1676,6 +1879,8 @@ target "php82-fpm-node22" { # thecodingmachine/php:8.2-v5-fpm-node20 target "php82-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php82-fpm-node20") + cache-to = cache_to("php82-fpm-node20") tags = tag("8.2", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -1692,6 +1897,8 @@ target "php82-fpm-node20" { # thecodingmachine/php:8.2-v5-fpm-node18 target "php82-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php82-fpm-node18") + cache-to = cache_to("php82-fpm-node18") tags = tag("8.2", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -1708,6 +1915,8 @@ target "php82-fpm-node18" { # thecodingmachine/php:8.2-v5-slim-cli target "php82-slim-cli" { inherits = ["default"] + cache-from = cache_from("php82-slim-cli") + cache-to = cache_to("php82-slim-cli") tags = tag("8.2", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -1721,6 +1930,8 @@ target "php82-slim-cli" { # The slim image of the variant with the extensions (not published) target "php82-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php82-slim-cli-with-extensions") + cache-to = cache_to("php82-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -1734,6 +1945,8 @@ target "php82-slim-cli-with-extensions" { # thecodingmachine/php:8.2-v5-cli target "php82-cli" { inherits = ["default"] + cache-from = cache_from("php82-cli") + cache-to = cache_to("php82-cli") tags = tag("8.2", "cli") dockerfile = "Dockerfile.cli" args = { @@ -1747,6 +1960,8 @@ target "php82-cli" { # thecodingmachine/php:8.2-v5-cli-node26 target "php82-cli-node26" { inherits = ["default"] + cache-from = cache_from("php82-cli-node26") + cache-to = cache_to("php82-cli-node26") tags = tag("8.2", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -1763,6 +1978,8 @@ target "php82-cli-node26" { # thecodingmachine/php:8.2-v5-cli-node24 target "php82-cli-node24" { inherits = ["default"] + cache-from = cache_from("php82-cli-node24") + cache-to = cache_to("php82-cli-node24") tags = tag("8.2", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -1779,6 +1996,8 @@ target "php82-cli-node24" { # thecodingmachine/php:8.2-v5-cli-node22 target "php82-cli-node22" { inherits = ["default"] + cache-from = cache_from("php82-cli-node22") + cache-to = cache_to("php82-cli-node22") tags = tag("8.2", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -1795,6 +2014,8 @@ target "php82-cli-node22" { # thecodingmachine/php:8.2-v5-cli-node20 target "php82-cli-node20" { inherits = ["default"] + cache-from = cache_from("php82-cli-node20") + cache-to = cache_to("php82-cli-node20") tags = tag("8.2", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -1811,6 +2032,8 @@ target "php82-cli-node20" { # thecodingmachine/php:8.2-v5-cli-node18 target "php82-cli-node18" { inherits = ["default"] + cache-from = cache_from("php82-cli-node18") + cache-to = cache_to("php82-cli-node18") tags = tag("8.2", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { @@ -1830,6 +2053,8 @@ target "php82-cli-node18" { # Layers shared by the images of all the variants (not published) target "php81-base" { inherits = ["default"] + cache-from = cache_from("php81-base") + cache-to = cache_to("php81-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -1839,6 +2064,8 @@ target "php81-base" { target "php81-extensions" { inherits = ["default"] + cache-from = cache_from("php81-extensions") + cache-to = cache_to("php81-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -1849,6 +2076,8 @@ target "php81-extensions" { # thecodingmachine/php:8.1-v5-slim-apache target "php81-slim-apache" { inherits = ["default"] + cache-from = cache_from("php81-slim-apache") + cache-to = cache_to("php81-slim-apache") tags = tag("8.1", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -1862,6 +2091,8 @@ target "php81-slim-apache" { # The slim image of the variant with the extensions (not published) target "php81-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php81-slim-apache-with-extensions") + cache-to = cache_to("php81-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -1875,6 +2106,8 @@ target "php81-slim-apache-with-extensions" { # thecodingmachine/php:8.1-v5-apache target "php81-apache" { inherits = ["default"] + cache-from = cache_from("php81-apache") + cache-to = cache_to("php81-apache") tags = tag("8.1", "apache") dockerfile = "Dockerfile.apache" args = { @@ -1888,6 +2121,8 @@ target "php81-apache" { # thecodingmachine/php:8.1-v5-apache-node26 target "php81-apache-node26" { inherits = ["default"] + cache-from = cache_from("php81-apache-node26") + cache-to = cache_to("php81-apache-node26") tags = tag("8.1", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -1904,6 +2139,8 @@ target "php81-apache-node26" { # thecodingmachine/php:8.1-v5-apache-node24 target "php81-apache-node24" { inherits = ["default"] + cache-from = cache_from("php81-apache-node24") + cache-to = cache_to("php81-apache-node24") tags = tag("8.1", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -1920,6 +2157,8 @@ target "php81-apache-node24" { # thecodingmachine/php:8.1-v5-apache-node22 target "php81-apache-node22" { inherits = ["default"] + cache-from = cache_from("php81-apache-node22") + cache-to = cache_to("php81-apache-node22") tags = tag("8.1", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -1936,6 +2175,8 @@ target "php81-apache-node22" { # thecodingmachine/php:8.1-v5-apache-node20 target "php81-apache-node20" { inherits = ["default"] + cache-from = cache_from("php81-apache-node20") + cache-to = cache_to("php81-apache-node20") tags = tag("8.1", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -1952,6 +2193,8 @@ target "php81-apache-node20" { # thecodingmachine/php:8.1-v5-apache-node18 target "php81-apache-node18" { inherits = ["default"] + cache-from = cache_from("php81-apache-node18") + cache-to = cache_to("php81-apache-node18") tags = tag("8.1", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -1968,6 +2211,8 @@ target "php81-apache-node18" { # thecodingmachine/php:8.1-v5-slim-fpm target "php81-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php81-slim-fpm") + cache-to = cache_to("php81-slim-fpm") tags = tag("8.1", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -1981,6 +2226,8 @@ target "php81-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php81-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php81-slim-fpm-with-extensions") + cache-to = cache_to("php81-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -1994,6 +2241,8 @@ target "php81-slim-fpm-with-extensions" { # thecodingmachine/php:8.1-v5-fpm target "php81-fpm" { inherits = ["default"] + cache-from = cache_from("php81-fpm") + cache-to = cache_to("php81-fpm") tags = tag("8.1", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -2007,6 +2256,8 @@ target "php81-fpm" { # thecodingmachine/php:8.1-v5-fpm-node26 target "php81-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php81-fpm-node26") + cache-to = cache_to("php81-fpm-node26") tags = tag("8.1", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -2023,6 +2274,8 @@ target "php81-fpm-node26" { # thecodingmachine/php:8.1-v5-fpm-node24 target "php81-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php81-fpm-node24") + cache-to = cache_to("php81-fpm-node24") tags = tag("8.1", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -2039,6 +2292,8 @@ target "php81-fpm-node24" { # thecodingmachine/php:8.1-v5-fpm-node22 target "php81-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php81-fpm-node22") + cache-to = cache_to("php81-fpm-node22") tags = tag("8.1", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -2055,6 +2310,8 @@ target "php81-fpm-node22" { # thecodingmachine/php:8.1-v5-fpm-node20 target "php81-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php81-fpm-node20") + cache-to = cache_to("php81-fpm-node20") tags = tag("8.1", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -2071,6 +2328,8 @@ target "php81-fpm-node20" { # thecodingmachine/php:8.1-v5-fpm-node18 target "php81-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php81-fpm-node18") + cache-to = cache_to("php81-fpm-node18") tags = tag("8.1", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -2087,6 +2346,8 @@ target "php81-fpm-node18" { # thecodingmachine/php:8.1-v5-slim-cli target "php81-slim-cli" { inherits = ["default"] + cache-from = cache_from("php81-slim-cli") + cache-to = cache_to("php81-slim-cli") tags = tag("8.1", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -2100,6 +2361,8 @@ target "php81-slim-cli" { # The slim image of the variant with the extensions (not published) target "php81-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php81-slim-cli-with-extensions") + cache-to = cache_to("php81-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -2113,6 +2376,8 @@ target "php81-slim-cli-with-extensions" { # thecodingmachine/php:8.1-v5-cli target "php81-cli" { inherits = ["default"] + cache-from = cache_from("php81-cli") + cache-to = cache_to("php81-cli") tags = tag("8.1", "cli") dockerfile = "Dockerfile.cli" args = { @@ -2126,6 +2391,8 @@ target "php81-cli" { # thecodingmachine/php:8.1-v5-cli-node26 target "php81-cli-node26" { inherits = ["default"] + cache-from = cache_from("php81-cli-node26") + cache-to = cache_to("php81-cli-node26") tags = tag("8.1", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -2142,6 +2409,8 @@ target "php81-cli-node26" { # thecodingmachine/php:8.1-v5-cli-node24 target "php81-cli-node24" { inherits = ["default"] + cache-from = cache_from("php81-cli-node24") + cache-to = cache_to("php81-cli-node24") tags = tag("8.1", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -2158,6 +2427,8 @@ target "php81-cli-node24" { # thecodingmachine/php:8.1-v5-cli-node22 target "php81-cli-node22" { inherits = ["default"] + cache-from = cache_from("php81-cli-node22") + cache-to = cache_to("php81-cli-node22") tags = tag("8.1", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -2174,6 +2445,8 @@ target "php81-cli-node22" { # thecodingmachine/php:8.1-v5-cli-node20 target "php81-cli-node20" { inherits = ["default"] + cache-from = cache_from("php81-cli-node20") + cache-to = cache_to("php81-cli-node20") tags = tag("8.1", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -2190,6 +2463,8 @@ target "php81-cli-node20" { # thecodingmachine/php:8.1-v5-cli-node18 target "php81-cli-node18" { inherits = ["default"] + cache-from = cache_from("php81-cli-node18") + cache-to = cache_to("php81-cli-node18") tags = tag("8.1", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { @@ -2209,6 +2484,8 @@ target "php81-cli-node18" { # Layers shared by the images of all the variants (not published) target "php80-base" { inherits = ["default"] + cache-from = cache_from("php80-base") + cache-to = cache_to("php80-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -2218,6 +2495,8 @@ target "php80-base" { target "php80-extensions" { inherits = ["default"] + cache-from = cache_from("php80-extensions") + cache-to = cache_to("php80-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -2228,6 +2507,8 @@ target "php80-extensions" { # thecodingmachine/php:8.0-v5-slim-apache target "php80-slim-apache" { inherits = ["default"] + cache-from = cache_from("php80-slim-apache") + cache-to = cache_to("php80-slim-apache") tags = tag("8.0", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -2241,6 +2522,8 @@ target "php80-slim-apache" { # The slim image of the variant with the extensions (not published) target "php80-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php80-slim-apache-with-extensions") + cache-to = cache_to("php80-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -2254,6 +2537,8 @@ target "php80-slim-apache-with-extensions" { # thecodingmachine/php:8.0-v5-apache target "php80-apache" { inherits = ["default"] + cache-from = cache_from("php80-apache") + cache-to = cache_to("php80-apache") tags = tag("8.0", "apache") dockerfile = "Dockerfile.apache" args = { @@ -2267,6 +2552,8 @@ target "php80-apache" { # thecodingmachine/php:8.0-v5-apache-node26 target "php80-apache-node26" { inherits = ["default"] + cache-from = cache_from("php80-apache-node26") + cache-to = cache_to("php80-apache-node26") tags = tag("8.0", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -2283,6 +2570,8 @@ target "php80-apache-node26" { # thecodingmachine/php:8.0-v5-apache-node24 target "php80-apache-node24" { inherits = ["default"] + cache-from = cache_from("php80-apache-node24") + cache-to = cache_to("php80-apache-node24") tags = tag("8.0", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -2299,6 +2588,8 @@ target "php80-apache-node24" { # thecodingmachine/php:8.0-v5-apache-node22 target "php80-apache-node22" { inherits = ["default"] + cache-from = cache_from("php80-apache-node22") + cache-to = cache_to("php80-apache-node22") tags = tag("8.0", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -2315,6 +2606,8 @@ target "php80-apache-node22" { # thecodingmachine/php:8.0-v5-apache-node20 target "php80-apache-node20" { inherits = ["default"] + cache-from = cache_from("php80-apache-node20") + cache-to = cache_to("php80-apache-node20") tags = tag("8.0", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -2331,6 +2624,8 @@ target "php80-apache-node20" { # thecodingmachine/php:8.0-v5-apache-node18 target "php80-apache-node18" { inherits = ["default"] + cache-from = cache_from("php80-apache-node18") + cache-to = cache_to("php80-apache-node18") tags = tag("8.0", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -2347,6 +2642,8 @@ target "php80-apache-node18" { # thecodingmachine/php:8.0-v5-slim-fpm target "php80-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php80-slim-fpm") + cache-to = cache_to("php80-slim-fpm") tags = tag("8.0", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -2360,6 +2657,8 @@ target "php80-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php80-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php80-slim-fpm-with-extensions") + cache-to = cache_to("php80-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -2373,6 +2672,8 @@ target "php80-slim-fpm-with-extensions" { # thecodingmachine/php:8.0-v5-fpm target "php80-fpm" { inherits = ["default"] + cache-from = cache_from("php80-fpm") + cache-to = cache_to("php80-fpm") tags = tag("8.0", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -2386,6 +2687,8 @@ target "php80-fpm" { # thecodingmachine/php:8.0-v5-fpm-node26 target "php80-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php80-fpm-node26") + cache-to = cache_to("php80-fpm-node26") tags = tag("8.0", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -2402,6 +2705,8 @@ target "php80-fpm-node26" { # thecodingmachine/php:8.0-v5-fpm-node24 target "php80-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php80-fpm-node24") + cache-to = cache_to("php80-fpm-node24") tags = tag("8.0", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -2418,6 +2723,8 @@ target "php80-fpm-node24" { # thecodingmachine/php:8.0-v5-fpm-node22 target "php80-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php80-fpm-node22") + cache-to = cache_to("php80-fpm-node22") tags = tag("8.0", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -2434,6 +2741,8 @@ target "php80-fpm-node22" { # thecodingmachine/php:8.0-v5-fpm-node20 target "php80-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php80-fpm-node20") + cache-to = cache_to("php80-fpm-node20") tags = tag("8.0", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -2450,6 +2759,8 @@ target "php80-fpm-node20" { # thecodingmachine/php:8.0-v5-fpm-node18 target "php80-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php80-fpm-node18") + cache-to = cache_to("php80-fpm-node18") tags = tag("8.0", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -2466,6 +2777,8 @@ target "php80-fpm-node18" { # thecodingmachine/php:8.0-v5-slim-cli target "php80-slim-cli" { inherits = ["default"] + cache-from = cache_from("php80-slim-cli") + cache-to = cache_to("php80-slim-cli") tags = tag("8.0", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -2479,6 +2792,8 @@ target "php80-slim-cli" { # The slim image of the variant with the extensions (not published) target "php80-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php80-slim-cli-with-extensions") + cache-to = cache_to("php80-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -2492,6 +2807,8 @@ target "php80-slim-cli-with-extensions" { # thecodingmachine/php:8.0-v5-cli target "php80-cli" { inherits = ["default"] + cache-from = cache_from("php80-cli") + cache-to = cache_to("php80-cli") tags = tag("8.0", "cli") dockerfile = "Dockerfile.cli" args = { @@ -2505,6 +2822,8 @@ target "php80-cli" { # thecodingmachine/php:8.0-v5-cli-node26 target "php80-cli-node26" { inherits = ["default"] + cache-from = cache_from("php80-cli-node26") + cache-to = cache_to("php80-cli-node26") tags = tag("8.0", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -2521,6 +2840,8 @@ target "php80-cli-node26" { # thecodingmachine/php:8.0-v5-cli-node24 target "php80-cli-node24" { inherits = ["default"] + cache-from = cache_from("php80-cli-node24") + cache-to = cache_to("php80-cli-node24") tags = tag("8.0", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -2537,6 +2858,8 @@ target "php80-cli-node24" { # thecodingmachine/php:8.0-v5-cli-node22 target "php80-cli-node22" { inherits = ["default"] + cache-from = cache_from("php80-cli-node22") + cache-to = cache_to("php80-cli-node22") tags = tag("8.0", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -2553,6 +2876,8 @@ target "php80-cli-node22" { # thecodingmachine/php:8.0-v5-cli-node20 target "php80-cli-node20" { inherits = ["default"] + cache-from = cache_from("php80-cli-node20") + cache-to = cache_to("php80-cli-node20") tags = tag("8.0", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -2569,6 +2894,8 @@ target "php80-cli-node20" { # thecodingmachine/php:8.0-v5-cli-node18 target "php80-cli-node18" { inherits = ["default"] + cache-from = cache_from("php80-cli-node18") + cache-to = cache_to("php80-cli-node18") tags = tag("8.0", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { @@ -2588,6 +2915,8 @@ target "php80-cli-node18" { # Layers shared by the images of all the variants (not published) target "php74-base" { inherits = ["default"] + cache-from = cache_from("php74-base") + cache-to = cache_to("php74-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -2597,6 +2926,8 @@ target "php74-base" { target "php74-extensions" { inherits = ["default"] + cache-from = cache_from("php74-extensions") + cache-to = cache_to("php74-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -2607,6 +2938,8 @@ target "php74-extensions" { # thecodingmachine/php:7.4-v5-slim-apache target "php74-slim-apache" { inherits = ["default"] + cache-from = cache_from("php74-slim-apache") + cache-to = cache_to("php74-slim-apache") tags = tag("7.4", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { @@ -2620,6 +2953,8 @@ target "php74-slim-apache" { # The slim image of the variant with the extensions (not published) target "php74-slim-apache-with-extensions" { inherits = ["default"] + cache-from = cache_from("php74-slim-apache-with-extensions") + cache-to = cache_to("php74-slim-apache-with-extensions") dockerfile = "Dockerfile.slim.apache" args = { VARIANT = "apache" @@ -2633,6 +2968,8 @@ target "php74-slim-apache-with-extensions" { # thecodingmachine/php:7.4-v5-apache target "php74-apache" { inherits = ["default"] + cache-from = cache_from("php74-apache") + cache-to = cache_to("php74-apache") tags = tag("7.4", "apache") dockerfile = "Dockerfile.apache" args = { @@ -2646,6 +2983,8 @@ target "php74-apache" { # thecodingmachine/php:7.4-v5-apache-node26 target "php74-apache-node26" { inherits = ["default"] + cache-from = cache_from("php74-apache-node26") + cache-to = cache_to("php74-apache-node26") tags = tag("7.4", "apache-node26") dockerfile = "Dockerfile.apache.node" args = { @@ -2662,6 +3001,8 @@ target "php74-apache-node26" { # thecodingmachine/php:7.4-v5-apache-node24 target "php74-apache-node24" { inherits = ["default"] + cache-from = cache_from("php74-apache-node24") + cache-to = cache_to("php74-apache-node24") tags = tag("7.4", "apache-node24") dockerfile = "Dockerfile.apache.node" args = { @@ -2678,6 +3019,8 @@ target "php74-apache-node24" { # thecodingmachine/php:7.4-v5-apache-node22 target "php74-apache-node22" { inherits = ["default"] + cache-from = cache_from("php74-apache-node22") + cache-to = cache_to("php74-apache-node22") tags = tag("7.4", "apache-node22") dockerfile = "Dockerfile.apache.node" args = { @@ -2694,6 +3037,8 @@ target "php74-apache-node22" { # thecodingmachine/php:7.4-v5-apache-node20 target "php74-apache-node20" { inherits = ["default"] + cache-from = cache_from("php74-apache-node20") + cache-to = cache_to("php74-apache-node20") tags = tag("7.4", "apache-node20") dockerfile = "Dockerfile.apache.node" args = { @@ -2710,6 +3055,8 @@ target "php74-apache-node20" { # thecodingmachine/php:7.4-v5-apache-node18 target "php74-apache-node18" { inherits = ["default"] + cache-from = cache_from("php74-apache-node18") + cache-to = cache_to("php74-apache-node18") tags = tag("7.4", "apache-node18") dockerfile = "Dockerfile.apache.node" args = { @@ -2726,6 +3073,8 @@ target "php74-apache-node18" { # thecodingmachine/php:7.4-v5-slim-fpm target "php74-slim-fpm" { inherits = ["default"] + cache-from = cache_from("php74-slim-fpm") + cache-to = cache_to("php74-slim-fpm") tags = tag("7.4", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { @@ -2739,6 +3088,8 @@ target "php74-slim-fpm" { # The slim image of the variant with the extensions (not published) target "php74-slim-fpm-with-extensions" { inherits = ["default"] + cache-from = cache_from("php74-slim-fpm-with-extensions") + cache-to = cache_to("php74-slim-fpm-with-extensions") dockerfile = "Dockerfile.slim.fpm" args = { VARIANT = "fpm" @@ -2752,6 +3103,8 @@ target "php74-slim-fpm-with-extensions" { # thecodingmachine/php:7.4-v5-fpm target "php74-fpm" { inherits = ["default"] + cache-from = cache_from("php74-fpm") + cache-to = cache_to("php74-fpm") tags = tag("7.4", "fpm") dockerfile = "Dockerfile.fpm" args = { @@ -2765,6 +3118,8 @@ target "php74-fpm" { # thecodingmachine/php:7.4-v5-fpm-node26 target "php74-fpm-node26" { inherits = ["default"] + cache-from = cache_from("php74-fpm-node26") + cache-to = cache_to("php74-fpm-node26") tags = tag("7.4", "fpm-node26") dockerfile = "Dockerfile.fpm.node" args = { @@ -2781,6 +3136,8 @@ target "php74-fpm-node26" { # thecodingmachine/php:7.4-v5-fpm-node24 target "php74-fpm-node24" { inherits = ["default"] + cache-from = cache_from("php74-fpm-node24") + cache-to = cache_to("php74-fpm-node24") tags = tag("7.4", "fpm-node24") dockerfile = "Dockerfile.fpm.node" args = { @@ -2797,6 +3154,8 @@ target "php74-fpm-node24" { # thecodingmachine/php:7.4-v5-fpm-node22 target "php74-fpm-node22" { inherits = ["default"] + cache-from = cache_from("php74-fpm-node22") + cache-to = cache_to("php74-fpm-node22") tags = tag("7.4", "fpm-node22") dockerfile = "Dockerfile.fpm.node" args = { @@ -2813,6 +3172,8 @@ target "php74-fpm-node22" { # thecodingmachine/php:7.4-v5-fpm-node20 target "php74-fpm-node20" { inherits = ["default"] + cache-from = cache_from("php74-fpm-node20") + cache-to = cache_to("php74-fpm-node20") tags = tag("7.4", "fpm-node20") dockerfile = "Dockerfile.fpm.node" args = { @@ -2829,6 +3190,8 @@ target "php74-fpm-node20" { # thecodingmachine/php:7.4-v5-fpm-node18 target "php74-fpm-node18" { inherits = ["default"] + cache-from = cache_from("php74-fpm-node18") + cache-to = cache_to("php74-fpm-node18") tags = tag("7.4", "fpm-node18") dockerfile = "Dockerfile.fpm.node" args = { @@ -2845,6 +3208,8 @@ target "php74-fpm-node18" { # thecodingmachine/php:7.4-v5-slim-cli target "php74-slim-cli" { inherits = ["default"] + cache-from = cache_from("php74-slim-cli") + cache-to = cache_to("php74-slim-cli") tags = tag("7.4", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { @@ -2858,6 +3223,8 @@ target "php74-slim-cli" { # The slim image of the variant with the extensions (not published) target "php74-slim-cli-with-extensions" { inherits = ["default"] + cache-from = cache_from("php74-slim-cli-with-extensions") + cache-to = cache_to("php74-slim-cli-with-extensions") dockerfile = "Dockerfile.slim.cli" args = { VARIANT = "cli" @@ -2871,6 +3238,8 @@ target "php74-slim-cli-with-extensions" { # thecodingmachine/php:7.4-v5-cli target "php74-cli" { inherits = ["default"] + cache-from = cache_from("php74-cli") + cache-to = cache_to("php74-cli") tags = tag("7.4", "cli") dockerfile = "Dockerfile.cli" args = { @@ -2884,6 +3253,8 @@ target "php74-cli" { # thecodingmachine/php:7.4-v5-cli-node26 target "php74-cli-node26" { inherits = ["default"] + cache-from = cache_from("php74-cli-node26") + cache-to = cache_to("php74-cli-node26") tags = tag("7.4", "cli-node26") dockerfile = "Dockerfile.cli.node" args = { @@ -2900,6 +3271,8 @@ target "php74-cli-node26" { # thecodingmachine/php:7.4-v5-cli-node24 target "php74-cli-node24" { inherits = ["default"] + cache-from = cache_from("php74-cli-node24") + cache-to = cache_to("php74-cli-node24") tags = tag("7.4", "cli-node24") dockerfile = "Dockerfile.cli.node" args = { @@ -2916,6 +3289,8 @@ target "php74-cli-node24" { # thecodingmachine/php:7.4-v5-cli-node22 target "php74-cli-node22" { inherits = ["default"] + cache-from = cache_from("php74-cli-node22") + cache-to = cache_to("php74-cli-node22") tags = tag("7.4", "cli-node22") dockerfile = "Dockerfile.cli.node" args = { @@ -2932,6 +3307,8 @@ target "php74-cli-node22" { # thecodingmachine/php:7.4-v5-cli-node20 target "php74-cli-node20" { inherits = ["default"] + cache-from = cache_from("php74-cli-node20") + cache-to = cache_to("php74-cli-node20") tags = tag("7.4", "cli-node20") dockerfile = "Dockerfile.cli.node" args = { @@ -2948,6 +3325,8 @@ target "php74-cli-node20" { # thecodingmachine/php:7.4-v5-cli-node18 target "php74-cli-node18" { inherits = ["default"] + cache-from = cache_from("php74-cli-node18") + cache-to = cache_to("php74-cli-node18") tags = tag("7.4", "cli-node18") dockerfile = "Dockerfile.cli.node" args = { diff --git a/utils/docker-bake.blueprint.hcl b/utils/docker-bake.blueprint.hcl index 39f4369e..6937e77b 100644 --- a/utils/docker-bake.blueprint.hcl +++ b/utils/docker-bake.blueprint.hcl @@ -34,6 +34,21 @@ variable "IS_RELEASE" {default = "0"} variable "GLOBAL_VERSION" {default = "v5"} variable "ARCH_SUFFIX" {default = ""} +# Registry of the cache of the layers between the runs (e.g. ghcr.io/thecodingmachine/php-cache), none by default. +# The cache is only read, unless CACHE_WRITE=1 +variable "CACHE_REPO" {default = ""} +variable "CACHE_WRITE" {default = "0"} + +function "cache_from" { + params = [NAME] + result = equal("", CACHE_REPO) ? [] : ["type=registry,ref=${CACHE_REPO}:${NAME}${ARCH_SUFFIX}"] +} + +function "cache_to" { + params = [NAME] + result = equal("", CACHE_REPO) || !equal("1", CACHE_WRITE) ? [] : ["type=registry,ref=${CACHE_REPO}:${NAME}${ARCH_SUFFIX},mode=max,image-manifest=true,oci-mediatypes=true,ignore-error=true"] +} + function "tag" { params = [PHP_VERSION, VARIANT] result = [ @@ -61,6 +76,8 @@ target "default" { # Layers shared by the images of all the variants (not published) target "php{{ $phpV | replace "." "" }}-base" { inherits = ["default"] + cache-from = cache_from("php{{ $phpV | replace "." "" }}-base") + cache-to = cache_to("php{{ $phpV | replace "." "" }}-base") dockerfile = "Dockerfile.base" output = ["type=cacheonly"] args = { @@ -70,6 +87,8 @@ target "php{{ $phpV | replace "." "" }}-base" { target "php{{ $phpV | replace "." "" }}-extensions" { inherits = ["default"] + cache-from = cache_from("php{{ $phpV | replace "." "" }}-extensions") + cache-to = cache_to("php{{ $phpV | replace "." "" }}-extensions") dockerfile = "Dockerfile.extensions" output = ["type=cacheonly"] contexts = { @@ -80,6 +99,8 @@ target "php{{ $phpV | replace "." "" }}-extensions" { # thecodingmachine/php:{{ $phpV }}-v5-slim-{{ $variant }} target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" { inherits = ["default"] + cache-from = cache_from("php{{ $phpV | replace "." "" }}-slim-{{ $variant }}") + cache-to = cache_to("php{{ $phpV | replace "." "" }}-slim-{{ $variant }}") tags = tag("{{ $phpV }}", "slim-{{ $variant }}") dockerfile = "Dockerfile.slim.{{ $variant }}" args = { @@ -93,6 +114,8 @@ target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" { # The slim image of the variant with the extensions (not published) target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}-with-extensions" { inherits = ["default"] + cache-from = cache_from("php{{ $phpV | replace "." "" }}-slim-{{ $variant }}-with-extensions") + cache-to = cache_to("php{{ $phpV | replace "." "" }}-slim-{{ $variant }}-with-extensions") dockerfile = "Dockerfile.slim.{{ $variant }}" args = { VARIANT = "{{ $variant }}" @@ -106,6 +129,8 @@ target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}-with-extensions" { # thecodingmachine/php:{{ $phpV }}-v5-{{ $variant }} target "php{{ $phpV | replace "." "" }}-{{ $variant }}" { inherits = ["default"] + cache-from = cache_from("php{{ $phpV | replace "." "" }}-{{ $variant }}") + cache-to = cache_to("php{{ $phpV | replace "." "" }}-{{ $variant }}") tags = tag("{{ $phpV }}", "{{ $variant }}") dockerfile = "Dockerfile.{{ $variant }}" args = { @@ -119,6 +144,8 @@ target "php{{ $phpV | replace "." "" }}-{{ $variant }}" { # thecodingmachine/php:{{ $phpV }}-v5-{{ $variant }}-node{{ $nodeV }} target "php{{ $phpV | replace "." "" }}-{{ $variant }}-node{{ $nodeV }}" { inherits = ["default"] + cache-from = cache_from("php{{ $phpV | replace "." "" }}-{{ $variant }}-node{{ $nodeV }}") + cache-to = cache_to("php{{ $phpV | replace "." "" }}-{{ $variant }}-node{{ $nodeV }}") tags = tag("{{ $phpV }}", "{{ $variant }}-node{{ $nodeV }}") dockerfile = "Dockerfile.{{ $variant }}.node" args = { From bdff28f72911840b2e01463695cd3aab5051d019 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Thu, 5 Nov 2026 20:20:48 +0100 Subject: [PATCH 6/6] Stop the container of test_dockerStop once its processes are started The test waited 3 seconds: on a loaded runner, the container was still starting, and the entrypoint only handles the stop signal at the end of its current step. --- tests-suite/tool-daemon.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests-suite/tool-daemon.sh b/tests-suite/tool-daemon.sh index 669bece4..b23bc189 100755 --- a/tests-suite/tool-daemon.sh +++ b/tests-suite/tool-daemon.sh @@ -3,6 +3,21 @@ IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}${ARCH_SUFFIX}" +# Waits until the main command of the variant answers and the daemon "sleep 300" runs in the container $1 +wait_started() { + local check + case "${VARIANT}" in + apache*) check='curl -s -o /dev/null http://localhost/ && pgrep -x sleep' ;; + fpm*) check='php-fpm-healthcheck && pgrep -x sleep' ;; + *) check='test "$(pgrep -cx sleep)" -ge 2' ;; + esac + for _ in $(seq 1 60); do + docker exec "$1" bash -c "${check}" > /dev/null 2>&1 && return 0 + sleep 0.5 + done + return 1 +} + ############################################################ ## DAEMON_COMMAND runs along with the main command, with the same user ############################################################ @@ -37,7 +52,7 @@ test_stopWhenDaemonExits() { test_dockerStop() { if [[ $VARIANT == cli* ]]; then COMMAND="sleep 300"; else COMMAND=""; fi docker run --name "${STOP_NAME}" ${RUN_OPTIONS} -d -e DAEMON_COMMAND_1="sleep 300" "${IMAGE}" ${COMMAND} > /dev/null - sleep 3 + wait_started "${STOP_NAME}" START=$(date +%s) docker stop "${STOP_NAME}" > /dev/null 2>&1 DURATION=$(( $(date +%s) - START ))