diff --git a/.github/workflows/build-php-images.yml b/.github/workflows/build-php-images.yml index c9ca907f..2b23c7d0 100644 --- a/.github/workflows/build-php-images.yml +++ b/.github/workflows/build-php-images.yml @@ -15,37 +15,45 @@ on: jobs: buildx: - runs-on: ubuntu-24.04 + runs-on: ${{ matrix.platform.runner }} env: TERM: xterm strategy: fail-fast: false matrix: - include: + target: &targets - image: php tag: 8.5-fpm-7 context: images/8.5-fpm + min_php: 8.5.12 - image: php tag: 8.5-apache-7 context: images/8.5-apache + min_php: 8.5.12 - image: php tag: 8.4-fpm-7 context: images/8.4-fpm + min_php: 8.4.27 - image: php tag: 8.4-apache-7 context: images/8.4-apache + min_php: 8.4.27 - image: php tag: 8.3-fpm-7 context: images/8.3-fpm + min_php: 8.3.36 - image: php tag: 8.3-apache-7 context: images/8.3-apache + min_php: 8.3.36 - image: php tag: 8.2-fpm-7 context: images/8.2-fpm + min_php: 8.2.35 - image: php tag: 8.2-apache-7 context: images/8.2-apache + min_php: 8.2.35 - image: php tag: 8.1-fpm-7 context: images/8.1-fpm @@ -95,11 +103,15 @@ jobs: tag: 5.6-apache-7 context: images/5.6-apache + platform: + - runner: ubuntu-24.04 + arch: amd64 + - runner: ubuntu-24.04-arm + arch: arm64 + steps: - name: Checkout code uses: actions/checkout@v7 - - name: Set up QEMU - uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Set tag suffix @@ -112,12 +124,73 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.release.outputs.tag_suffix }} + - name: Build and push devwithlando/${{ matrix.target.image }}:${{ matrix.target.tag }}${{ steps.release.outputs.tag_suffix }} + id: build uses: docker/build-push-action@v7 with: - context: ${{ matrix.context }} - platforms: linux/amd64,linux/arm64 + context: ${{ matrix.target.context }} + platforms: linux/${{ matrix.platform.arch }} push: true - tags: devwithlando/${{ matrix.image }}:${{ matrix.tag }}${{ steps.release.outputs.tag_suffix }} - cache-from: type=gha,scope=${{ matrix.image }}-${{ matrix.tag }} - cache-to: type=gha,mode=max,scope=${{ matrix.image }}-${{ matrix.tag }} + outputs: type=image,name=devwithlando/${{ matrix.target.image }},push-by-digest=true,name-canonical=true,push=true + pull: true + build-args: MIN_PHP=${{ matrix.target.min_php }} + cache-from: type=gha,scope=${{ matrix.target.image }}-${{ matrix.target.tag }}-${{ matrix.platform.arch }} + cache-to: type=gha,mode=max,scope=${{ matrix.target.image }}-${{ matrix.target.tag }}-${{ matrix.platform.arch }} + + - name: Export digest + env: + DIGEST: ${{ steps.build.outputs.digest }} + run: | + mkdir -p "$RUNNER_TEMP/digests" + touch "$RUNNER_TEMP/digests/${DIGEST#sha256:}" + - name: Upload digest + uses: actions/upload-artifact@v6 + with: + name: digests-${{ matrix.target.tag }}-${{ matrix.platform.arch }} + path: ${{ runner.temp }}/digests/* + retention-days: 1 + + merge: + # A failed unrelated target must not block complete security-image pairs. + if: ${{ !cancelled() }} + needs: buildx + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + target: *targets + steps: + - name: Download amd64 digest + uses: actions/download-artifact@v7 + with: + name: digests-${{ matrix.target.tag }}-amd64 + path: ${{ runner.temp }}/digests/amd64 + - name: Download arm64 digest + uses: actions/download-artifact@v7 + with: + name: digests-${{ matrix.target.tag }}-arm64 + path: ${{ runner.temp }}/digests/arm64 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + - name: Login to DockerHub + uses: docker/login-action@v4 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Publish multiarch tag + working-directory: ${{ runner.temp }}/digests + env: + IMAGE: devwithlando/${{ matrix.target.image }} + TAG: ${{ matrix.target.tag }}${{ github.event_name == 'pull_request' && '-edge' || '' }} + run: | + shopt -s nullglob + amd64=(amd64/*) + arm64=(arm64/*) + test "${#amd64[@]}" -eq 1 + test "${#arm64[@]}" -eq 1 + digests=("${amd64[0]##*/}" "${arm64[0]##*/}") + for digest in "${digests[@]}"; do + [[ "$digest" =~ ^[a-f0-9]{64}$ ]] + done + docker buildx imagetools create --tag "$IMAGE:$TAG" "${digests[@]/#/$IMAGE@sha256:}" + docker buildx imagetools inspect "$IMAGE:$TAG" diff --git a/.github/workflows/pr-php-tests.yml b/.github/workflows/pr-php-tests.yml index ac37cd4e..fb598a75 100644 --- a/.github/workflows/pr-php-tests.yml +++ b/.github/workflows/pr-php-tests.yml @@ -63,10 +63,11 @@ jobs: lando-plugin: true version: dev sync: false - - name: Setup lando ${{ github.event.inputs.lando-version }} + - name: Setup lando ${{ github.event.inputs.lando-version || matrix.lando-version }} uses: lando/setup-lando@v3 with: - lando-version: ${{ github.event.inputs.lando-version }} + lando-version: ${{ github.event.inputs.lando-version || matrix.lando-version }} + lando-version-file: '' config: | setup.skipCommonPlugins=true setup.plugins.@lando/php=/home/runner/work/php/php @@ -78,3 +79,5 @@ jobs: cleanup-header: "Destroy tests" shell: bash stdin: true + # npm ci --production skips the local dev Leia; pin the global fallback to the lockfile version (latest needs Node >=24). + version: '0.6.7' diff --git a/.github/workflows/pr-unit-tests.yml b/.github/workflows/pr-unit-tests.yml index 461b8cfd..deca439d 100644 --- a/.github/workflows/pr-unit-tests.yml +++ b/.github/workflows/pr-unit-tests.yml @@ -11,7 +11,7 @@ jobs: os: - windows-2022 - ubuntu-24.04 - - macos-15 + - macos-15-intel node-version: - '20' steps: diff --git a/AGENTS.md b/AGENTS.md index 29b3fd0d..2b846bd3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -79,3 +79,7 @@ nyc covers: lib/, recipes/, services/, types/ - Root `.lando.yml` is for docs site (vitepress), not plugin testing - Test file `test/auth.spec.js` is placeholder ("should have tests") - PHP config uses EJS templates (`.conf.tpl` extension) + +## Multi-version docs builds + +`npm run docs:mvb` temporarily checks out release tags in the current worktree. Run it only in a disposable checkout, without concurrent edits or Git operations; use `npm run docs:build` for a non-switching local docs check. diff --git a/CHANGELOG.md b/CHANGELOG.md index ee1d58b6..7b7e25b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) +* Added minimum PHP version build checks for supported PHP `8.2`–`8.5` images [#255](https://github.com/lando/php/pull/255) + ## v1.12.0 - [March 8, 2026](https://github.com/lando/php/releases/tag/v1.12.0) * Enabled `mod_headers` and `mod_expires` Apache modules by default [#243](https://github.com/lando/php/issues/243) diff --git a/examples/7.3/.lando.yml b/examples/7.3/.lando.yml index d8e13d20..294f4517 100644 --- a/examples/7.3/.lando.yml +++ b/examples/7.3/.lando.yml @@ -9,6 +9,12 @@ services: type: php:7.3 via: cli build_as_root: + - >- + sed -i + -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' + /etc/apt/sources.list + - echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date - curl -sL https://deb.nodesource.com/setup_20.x | bash - - apt-get update -y - apt-get install -y nodejs diff --git a/images/7.3-apache/Dockerfile b/images/7.3-apache/Dockerfile index c7c49a6b..9e454c29 100644 --- a/images/7.3-apache/Dockerfile +++ b/images/7.3-apache/Dockerfile @@ -2,6 +2,10 @@ FROM php:7.3-apache-bullseye +RUN sed -i -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \ + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date + # Install dependencies we need RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \ && apt -y update && apt-get install -y \ diff --git a/images/7.3-fpm/Dockerfile b/images/7.3-fpm/Dockerfile index beca57c1..4162f8f7 100644 --- a/images/7.3-fpm/Dockerfile +++ b/images/7.3-fpm/Dockerfile @@ -2,6 +2,10 @@ FROM php:7.3-fpm-bullseye +RUN sed -i -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \ + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date + # Install dependencies we need RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \ && apt -y update && apt-get install -y \ diff --git a/images/7.4-apache/Dockerfile b/images/7.4-apache/Dockerfile index 5e672b21..a60ffabe 100644 --- a/images/7.4-apache/Dockerfile +++ b/images/7.4-apache/Dockerfile @@ -2,6 +2,10 @@ FROM php:7.4-apache-bullseye +RUN sed -i -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \ + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date + ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ RUN \ diff --git a/images/7.4-fpm/Dockerfile b/images/7.4-fpm/Dockerfile index 8d105014..70d3356c 100644 --- a/images/7.4-fpm/Dockerfile +++ b/images/7.4-fpm/Dockerfile @@ -2,6 +2,10 @@ FROM php:7.4-fpm-bullseye +RUN sed -i -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \ + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date + ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ RUN \ diff --git a/images/8.0-apache/Dockerfile b/images/8.0-apache/Dockerfile index ec5fc3c9..337fb434 100644 --- a/images/8.0-apache/Dockerfile +++ b/images/8.0-apache/Dockerfile @@ -2,6 +2,10 @@ FROM php:8.0-apache-bullseye +RUN sed -i -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \ + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date + ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ ENV IPE_PROCESSOR_COUNT=1 diff --git a/images/8.0-fpm/Dockerfile b/images/8.0-fpm/Dockerfile index 4d1f0680..35d83186 100644 --- a/images/8.0-fpm/Dockerfile +++ b/images/8.0-fpm/Dockerfile @@ -2,6 +2,10 @@ FROM php:8.0-fpm-bullseye +RUN sed -i -e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \ + -e 's|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list \ + && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-release-date + ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ RUN \ diff --git a/images/8.2-apache/Dockerfile b/images/8.2-apache/Dockerfile index d410ab07..ad38cf98 100644 --- a/images/8.2-apache/Dockerfile +++ b/images/8.2-apache/Dockerfile @@ -1,6 +1,8 @@ # docker build -t devwithlando/php:8.2-apache-7 . FROM php:8.2-apache-bookworm +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ diff --git a/images/8.2-fpm/Dockerfile b/images/8.2-fpm/Dockerfile index 7577dfa0..b06f76e8 100644 --- a/images/8.2-fpm/Dockerfile +++ b/images/8.2-fpm/Dockerfile @@ -1,6 +1,8 @@ # docker build -t devwithlando/php:8.2-fpm-7 . FROM php:8.2-fpm-bookworm +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ diff --git a/images/8.3-apache/Dockerfile b/images/8.3-apache/Dockerfile index 45b5e5bf..e008dafc 100644 --- a/images/8.3-apache/Dockerfile +++ b/images/8.3-apache/Dockerfile @@ -4,6 +4,8 @@ FROM mysql:8.0 AS mysql-client-80 FROM mysql:8.4 AS mysql-client-84 FROM php:8.3-apache-trixie +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ARG TARGETARCH diff --git a/images/8.3-fpm/Dockerfile b/images/8.3-fpm/Dockerfile index 6fb8f129..d70fafe9 100644 --- a/images/8.3-fpm/Dockerfile +++ b/images/8.3-fpm/Dockerfile @@ -4,6 +4,8 @@ FROM mysql:8.0 AS mysql-client-80 FROM mysql:8.4 AS mysql-client-84 FROM php:8.3-fpm-trixie +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ARG TARGETARCH diff --git a/images/8.4-apache/Dockerfile b/images/8.4-apache/Dockerfile index 507210b5..d9103989 100644 --- a/images/8.4-apache/Dockerfile +++ b/images/8.4-apache/Dockerfile @@ -4,6 +4,8 @@ FROM mysql:8.0 AS mysql-client-80 FROM mysql:8.4 AS mysql-client-84 FROM php:8.4-apache-trixie +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ARG TARGETARCH diff --git a/images/8.4-fpm/Dockerfile b/images/8.4-fpm/Dockerfile index 153811ce..afe46e14 100644 --- a/images/8.4-fpm/Dockerfile +++ b/images/8.4-fpm/Dockerfile @@ -4,6 +4,8 @@ FROM mysql:8.0 AS mysql-client-80 FROM mysql:8.4 AS mysql-client-84 FROM php:8.4-fpm-trixie +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ARG TARGETARCH diff --git a/images/8.5-apache/Dockerfile b/images/8.5-apache/Dockerfile index 6b560662..082ae48e 100644 --- a/images/8.5-apache/Dockerfile +++ b/images/8.5-apache/Dockerfile @@ -4,6 +4,8 @@ FROM mysql:8.0 AS mysql-client-80 FROM mysql:8.4 AS mysql-client-84 FROM php:8.5-apache-trixie +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ARG TARGETARCH diff --git a/images/8.5-fpm/Dockerfile b/images/8.5-fpm/Dockerfile index 38d497a4..81cc4dce 100644 --- a/images/8.5-fpm/Dockerfile +++ b/images/8.5-fpm/Dockerfile @@ -4,6 +4,8 @@ FROM mysql:8.0 AS mysql-client-80 FROM mysql:8.4 AS mysql-client-84 FROM php:8.5-fpm-trixie +ARG MIN_PHP= +RUN [ -z "$MIN_PHP" ] || dpkg --compare-versions "$PHP_VERSION" ge "$MIN_PHP" || { echo "PHP $PHP_VERSION < $MIN_PHP"; exit 1; } ARG TARGETARCH