From 8181ca0bfa6f58e6339f2f8dfba9d52af76c7a89 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Wed, 21 Oct 2026 15:20:29 -0700 Subject: [PATCH 1/2] Rebuild every image weekly Images were only rebuilt when a Dockerfile changed or the workflow was run by hand, so a new php.net patch release in the official php or dunglas/frankenphp images, or an Alpine package fix, never reached the tags on its own. Add a Monday 10:00 UTC schedule. A scheduled run builds every image (each build condition now also checks github.event_name == 'schedule', since workflow_dispatch inputs are empty then) without the layer cache, which would otherwise keep last week's packages whenever the base image is unchanged. Every build step pulls its base image. The README notes the rebuild, including that it refreshes the current commit's - tags. --- .github/workflows/build-and-push.yml | 91 +++++++++++++++++----------- README.md | 4 +- 2 files changed, 59 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 48c0d74..bf36fc6 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -3,6 +3,13 @@ name: Build and Push Docker Images on: push: branches: [main] + # Weekly rebuild of every image, so new php.net patch releases (via the + # official php and dunglas/frankenphp base images) and Alpine package + # fixes reach the tags without a Dockerfile change. Scheduled runs build + # everything (each build condition checks github.event_name) and skip the + # layer cache (no-cache on each build step). + schedule: + - cron: "0 10 * * 1" # Mondays 10:00 UTC workflow_dispatch: inputs: force_build_all: @@ -141,7 +148,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push ${{ matrix.name }} - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, matrix.file) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, matrix.file) }} uses: docker/build-push-action@v7 with: context: ${{ matrix.context }} @@ -152,6 +159,10 @@ jobs: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}-latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}-${{ github.sha }} + # Scheduled runs rebuild from scratch: a cached layer would keep + # last week's Alpine packages whenever the base image is unchanged. + no-cache: ${{ github.event_name == 'schedule' }} + pull: true cache-from: type=gha,scope=${{ matrix.name }} cache-to: type=gha,mode=max,scope=${{ matrix.name }} @@ -182,15 +193,15 @@ jobs: - { version: "8.5", arch: arm64, force_input: build_php_85 } steps: - name: Checkout code - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/checkout@v7 - name: Set up Docker Buildx - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/setup-buildx-action@v4 - name: Log in to GHCR - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} @@ -199,25 +210,29 @@ jobs: - name: Build and push by digest (${{ matrix.version }}, ${{ matrix.arch }}) id: build - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/build-push-action@v7 with: context: php/${{ matrix.version }}/frankenphp file: php/${{ matrix.version }}/frankenphp/Dockerfile platforms: linux/${{ matrix.arch }} outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true + # Scheduled runs rebuild from scratch: a cached layer would keep + # last week's Alpine packages whenever the base image is unchanged. + no-cache: ${{ github.event_name == 'schedule' }} + pull: true cache-from: type=gha,scope=8.${{ matrix.version }}-frankenphp-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=8.${{ matrix.version }}-frankenphp-${{ matrix.arch }} - name: Export digest - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - name: Upload digest - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/upload-artifact@v4 with: name: digest-fpbase-${{ matrix.version }}-${{ matrix.arch }} @@ -247,25 +262,25 @@ jobs: # Exact artifact names: a missing arch fails here rather than # publishing a single-arch tag. - name: Download digest (amd64) - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/download-artifact@v4 with: path: /tmp/digests name: digest-fpbase-${{ matrix.version }}-amd64 - name: Download digest (arm64) - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/download-artifact@v4 with: path: /tmp/digests name: digest-fpbase-${{ matrix.version }}-arm64 - name: Set up Docker Buildx - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/setup-buildx-action@v4 - name: Log in to GHCR - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} @@ -273,7 +288,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Create manifest list and push - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} working-directory: /tmp/digests run: | # Exactly one amd64 and one arm64 digest. @@ -320,15 +335,15 @@ jobs: - { version: "8.5", variant: wordpress, file: Dockerfile.wordpress, arch: arm64, force_input: build_php_85 } steps: - name: Checkout code - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/checkout@v7 - name: Set up Docker Buildx - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/setup-buildx-action@v4 - name: Log in to GHCR - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} @@ -337,7 +352,7 @@ jobs: - name: Build and push by digest (${{ matrix.version }}-${{ matrix.variant }}, ${{ matrix.arch }}) id: build - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/build-push-action@v7 with: context: php/${{ matrix.version }}/frankenphp @@ -354,18 +369,22 @@ jobs: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}-frankenphp-latest=docker-image://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}-frankenphp-${{ github.sha }} platforms: linux/${{ matrix.arch }} outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true + # Scheduled runs rebuild from scratch: a cached layer would keep + # last week's Alpine packages whenever the base image is unchanged. + no-cache: ${{ github.event_name == 'schedule' }} + pull: true cache-from: type=gha,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} - name: Export digest - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - name: Upload digest - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/upload-artifact@v4 with: name: digest-fpdep-${{ matrix.version }}-${{ matrix.variant }}-${{ matrix.arch }} @@ -397,25 +416,25 @@ jobs: # wordpress that glob also matched wordpress-dev's digests, so the # -wordpress tags also carried the dev images. - name: Download digest (amd64) - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/download-artifact@v4 with: path: /tmp/digests name: digest-fpdep-${{ matrix.version }}-${{ matrix.variant }}-amd64 - name: Download digest (arm64) - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/download-artifact@v4 with: path: /tmp/digests name: digest-fpdep-${{ matrix.version }}-${{ matrix.variant }}-arm64 - name: Set up Docker Buildx - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/setup-buildx-action@v4 - name: Log in to GHCR - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} @@ -423,7 +442,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Create manifest list and push - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} working-directory: /tmp/digests run: | # Exactly one amd64 and one arm64 digest. @@ -458,15 +477,15 @@ jobs: - { version: "8.5", variant: wordpress-dev, file: Dockerfile.wordpress-dev, arch: arm64, force_input: build_php_85 } steps: - name: Checkout code - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/checkout@v7 - name: Set up Docker Buildx - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/setup-buildx-action@v4 - name: Log in to GHCR - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} @@ -475,7 +494,7 @@ jobs: - name: Build and push by digest (${{ matrix.version }}-${{ matrix.variant }}, ${{ matrix.arch }}) id: build - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/build-push-action@v7 with: context: php/${{ matrix.version }}/frankenphp @@ -490,18 +509,22 @@ jobs: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}-frankenphp-wordpress=docker-image://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}-frankenphp-wordpress-${{ github.sha }} platforms: linux/${{ matrix.arch }} outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true + # Scheduled runs rebuild from scratch: a cached layer would keep + # last week's Alpine packages whenever the base image is unchanged. + no-cache: ${{ github.event_name == 'schedule' }} + pull: true cache-from: type=gha,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} - name: Export digest - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - name: Upload digest - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/{1}', matrix.version, matrix.file)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/upload-artifact@v4 with: name: digest-fpdep-${{ matrix.version }}-${{ matrix.variant }}-${{ matrix.arch }} @@ -528,25 +551,25 @@ jobs: # Exact artifact names: a missing arch fails here rather than # publishing a single-arch tag. - name: Download digest (amd64) - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/download-artifact@v4 with: path: /tmp/digests name: digest-fpdep-${{ matrix.version }}-${{ matrix.variant }}-amd64 - name: Download digest (arm64) - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: actions/download-artifact@v4 with: path: /tmp/digests name: digest-fpdep-${{ matrix.version }}-${{ matrix.variant }}-arm64 - name: Set up Docker Buildx - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/setup-buildx-action@v4 - name: Log in to GHCR - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} @@ -554,7 +577,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Create manifest list and push - if: ${{ inputs.force_build_all || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} + if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile.{1}', matrix.version, matrix.variant)) || (contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/Dockerfile', matrix.version)) || contains(needs.detect-changes.outputs.changed_files, format('php/{0}/frankenphp/docker-configure', matrix.version))) }} working-directory: /tmp/digests run: | # Exactly one amd64 and one arm64 digest. diff --git a/README.md b/README.md index 188eba4..455fb26 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Docker images for PHP, published to `ghcr.io/aliasproject/php`. The primary offe | 8.4 | ✅ | ✅ | ✅ | ✅ | | 8.5 | ✅ | ✅ | ✅ | ✅ | -Tags follow `-` (e.g. `8.4-frankenphp-wordpress`), each also published as `-latest` and pinned to a commit as `-`. +Tags follow `-` (e.g. `8.4-frankenphp-wordpress`), each also published as `-latest` and as `-` for the commit it was built from. Every image is rebuilt weekly to pick up base-image and package updates, which also refreshes the `-` tag of the current commit; pin by digest (`@sha256:…`) for a byte-for-byte fixed image. ```sh docker pull ghcr.io/aliasproject/php:8.4-frankenphp @@ -22,7 +22,7 @@ docker pull ghcr.io/aliasproject/php:8.4-frankenphp ## Variants -- **cli** — the PHP CLI with unlimited execution time. 8.3–8.5 are built on the official `php:-cli-alpine` images, so a rebuild picks up the latest php.net patch release (7.4–8.1 still use Alpine's EOL packages). Images are only rebuilt when their Dockerfile changes or the workflow is run by hand. PHP's ini files are in `/usr/local/etc/php` (`conf.d/` for overrides). 8.3–8.5 are identical apart from the PHP version: a minimal extension set (`pdo_mysql`, `bcmath`, `intl`, `pcntl`, `zip`, etc.), a 512M memory limit, and an unprivileged `appuser` in group `0`. Backend and library extensions (`mysqli`, `gd`, `imagick`, `redis`, `igbinary`, …) belong in a derived image such as `php/8.4/cli/Dockerfile.wordpress`. +- **cli** — the PHP CLI with unlimited execution time. 8.3–8.5 are built on the official `php:-cli-alpine` images, so a rebuild picks up the latest php.net patch release (7.4–8.1 still use Alpine's EOL packages). Every image is also rebuilt weekly (Mondays 10:00 UTC), so tags pick up new patch releases without a Dockerfile change. PHP's ini files are in `/usr/local/etc/php` (`conf.d/` for overrides). 8.3–8.5 are identical apart from the PHP version: a minimal extension set (`pdo_mysql`, `bcmath`, `intl`, `pcntl`, `zip`, etc.), a 512M memory limit, and an unprivileged `appuser` in group `0`. Backend and library extensions (`mysqli`, `gd`, `imagick`, `redis`, `igbinary`, …) belong in a derived image such as `php/8.4/cli/Dockerfile.wordpress`. - **frankenphp** — FrankenPHP serves PHP directly through Caddy; no separate web server. Minimal extension set, non-root by default, mail sent through `msmtp`, Composer baked in, `HEALTHCHECK` against Caddy's admin API. - **frankenphp (dev)** — the FrankenPHP base with extra extensions (`mysqli`, `gd`, `exif`, `imagick`, `redis`, `igbinary`, `soap`) for local development. - **frankenphp (wordpress)** — the FrankenPHP base with the same extensions as `dev`, plus a hardening policy suited to running WordPress (see below). From a6f11db0962cd6296bce3c3d1b0f0ba573e5a654 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Wed, 21 Oct 2026 15:26:03 -0700 Subject: [PATCH 2/2] Hold back child images when their parent failed in this run On a scheduled run the current commit's - parent tags already exist from an earlier run, so the build-contexts pin no longer catches a parent that failed in this run: the dependent and wordpress-dev images would rebuild and republish on last week's parent. Run each child and merge job only when the job it depends on succeeded. Also skip the EOL 7.4-8.1 cli images on schedule (their Alpine branches get no updates), drop pull: true (the docker-container builder resolves base images from the registry anyway), and say in the README and the workflow comment that frankenphp images stay on their pinned FrankenPHP version. --- .github/workflows/build-and-push.yml | 48 +++++++++++++++++----------- README.md | 4 +-- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index bf36fc6..46683fd 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -3,11 +3,13 @@ name: Build and Push Docker Images on: push: branches: [main] - # Weekly rebuild of every image, so new php.net patch releases (via the - # official php and dunglas/frankenphp base images) and Alpine package - # fixes reach the tags without a Dockerfile change. Scheduled runs build - # everything (each build condition checks github.event_name) and skip the - # layer cache (no-cache on each build step). + # Weekly rebuild, so updates to the base images (new php.net patch + # releases in the official php images; rebuilds of the pinned + # dunglas/frankenphp version) and Alpine package fixes reach the tags + # without a Dockerfile change. Scheduled runs build everything except the + # EOL cli images (each build condition checks github.event_name) and skip + # the layer cache (no-cache on each build step). A new FrankenPHP release + # still needs FRANKENPHP_VERSION bumped by hand. schedule: - cron: "0 10 * * 1" # Mondays 10:00 UTC workflow_dispatch: @@ -123,9 +125,9 @@ jobs: fail-fast: false matrix: include: - - { name: 7.4-cli, context: php/7.4/cli, file: php/7.4/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_74, tag: 7.4-cli } - - { name: 8.0-cli, context: php/8.0/cli, file: php/8.0/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_80, tag: 8.0-cli } - - { name: 8.1-cli, context: php/8.1/cli, file: php/8.1/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_81, tag: 8.1-cli } + - { name: 7.4-cli, context: php/7.4/cli, file: php/7.4/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_74, tag: 7.4-cli, eol: true } + - { name: 8.0-cli, context: php/8.0/cli, file: php/8.0/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_80, tag: 8.0-cli, eol: true } + - { name: 8.1-cli, context: php/8.1/cli, file: php/8.1/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_81, tag: 8.1-cli, eol: true } - { name: 8.3-cli, context: php/8.3/cli, file: php/8.3/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_83, tag: 8.3-cli } - { name: 8.4-cli, context: php/8.4/cli, file: php/8.4/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_84, tag: 8.4-cli } - { name: 8.5-cli, context: php/8.5/cli, file: php/8.5/cli/Dockerfile, platforms: "linux/amd64,linux/arm64", force_input: build_php_85, tag: 8.5-cli } @@ -148,7 +150,9 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push ${{ matrix.name }} - if: ${{ inputs.force_build_all || github.event_name == 'schedule' || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, matrix.file) }} + # EOL images (eol: true) skip the weekly rebuild: their Alpine branches get + # no updates, so it would only re-push identical images. + if: ${{ inputs.force_build_all || (github.event_name == 'schedule' && !matrix.eol) || inputs[matrix.force_input] || contains(needs.detect-changes.outputs.changed_files, matrix.file) }} uses: docker/build-push-action@v7 with: context: ${{ matrix.context }} @@ -162,7 +166,6 @@ jobs: # Scheduled runs rebuild from scratch: a cached layer would keep # last week's Alpine packages whenever the base image is unchanged. no-cache: ${{ github.event_name == 'schedule' }} - pull: true cache-from: type=gha,scope=${{ matrix.name }} cache-to: type=gha,mode=max,scope=${{ matrix.name }} @@ -220,7 +223,6 @@ jobs: # Scheduled runs rebuild from scratch: a cached layer would keep # last week's Alpine packages whenever the base image is unchanged. no-cache: ${{ github.event_name == 'schedule' }} - pull: true cache-from: type=gha,scope=8.${{ matrix.version }}-frankenphp-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=8.${{ matrix.version }}-frankenphp-${{ matrix.arch }} @@ -308,7 +310,11 @@ jobs: # unrelated fast cli legs. build-frankenphp-dependent: needs: [detect-changes, merge-frankenphp-base] - if: ${{ !cancelled() }} + # Only on a parent that this run published: a scheduled run's - tags + # already exist from an earlier run, so a failed parent would otherwise + # leave the child building on last week's image. Over-conservative on + # purpose: one version's failure holds back the others' children too. + if: ${{ !cancelled() && needs.merge-frankenphp-base.result == 'success' }} runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} permissions: contents: read @@ -360,7 +366,8 @@ jobs: # Build FROM the parent published for this commit (its - tag), # not whatever the floating tag pointed at when this leg started: if # no run at this commit published the parent, this fails instead of - # building on a stale image. The parent always rebuilds when this + # building on a stale image (on a scheduled run the tag already + # exists, so the job-level parent-success check covers that case). The parent always rebuilds when this # does (changed_files is one string, so contains() on .../Dockerfile # matches Dockerfile.*). # Both names, since some variants are FROM -latest. @@ -372,7 +379,6 @@ jobs: # Scheduled runs rebuild from scratch: a cached layer would keep # last week's Alpine packages whenever the base image is unchanged. no-cache: ${{ github.event_name == 'schedule' }} - pull: true cache-from: type=gha,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} @@ -394,7 +400,7 @@ jobs: merge-frankenphp-dependent: needs: [detect-changes, build-frankenphp-dependent] - if: ${{ !cancelled() }} + if: ${{ !cancelled() && needs.build-frankenphp-dependent.result == 'success' }} runs-on: ubuntu-latest permissions: contents: read @@ -458,7 +464,11 @@ jobs: # as wordpress it raced, and built on the previously published image. build-frankenphp-wordpress-dev: needs: [detect-changes, merge-frankenphp-dependent] - if: ${{ !cancelled() }} + # Only on a parent that this run published: a scheduled run's - tags + # already exist from an earlier run, so a failed parent would otherwise + # leave wordpress-dev building on last week's image. Over-conservative on + # purpose: one version's failure holds back the others' children too. + if: ${{ !cancelled() && needs.merge-frankenphp-dependent.result == 'success' }} runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} permissions: contents: read @@ -502,7 +512,8 @@ jobs: # Build FROM the parent published for this commit (its - tag), # not whatever the floating tag pointed at when this leg started: if # no run at this commit published the parent, this fails instead of - # building on a stale image. The parent always rebuilds when this + # building on a stale image (on a scheduled run the tag already + # exists, so the job-level parent-success check covers that case). The parent always rebuilds when this # does (changed_files is one string, so contains() on .../Dockerfile # matches Dockerfile.*). build-contexts: | @@ -512,7 +523,6 @@ jobs: # Scheduled runs rebuild from scratch: a cached layer would keep # last week's Alpine packages whenever the base image is unchanged. no-cache: ${{ github.event_name == 'schedule' }} - pull: true cache-from: type=gha,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.version }}-frankenphp-${{ matrix.variant }}-${{ matrix.arch }} @@ -534,7 +544,7 @@ jobs: merge-frankenphp-wordpress-dev: needs: [detect-changes, build-frankenphp-wordpress-dev] - if: ${{ !cancelled() }} + if: ${{ !cancelled() && needs.build-frankenphp-wordpress-dev.result == 'success' }} runs-on: ubuntu-latest permissions: contents: read diff --git a/README.md b/README.md index 455fb26..458f7a6 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Docker images for PHP, published to `ghcr.io/aliasproject/php`. The primary offe | 8.4 | ✅ | ✅ | ✅ | ✅ | | 8.5 | ✅ | ✅ | ✅ | ✅ | -Tags follow `-` (e.g. `8.4-frankenphp-wordpress`), each also published as `-latest` and as `-` for the commit it was built from. Every image is rebuilt weekly to pick up base-image and package updates, which also refreshes the `-` tag of the current commit; pin by digest (`@sha256:…`) for a byte-for-byte fixed image. +Tags follow `-` (e.g. `8.4-frankenphp-wordpress`), each also published as `-latest` and as `-` for the commit it was built from. Every image except the EOL 7.4–8.1 CLI images is rebuilt weekly (Mondays 10:00 UTC) to pick up base-image and Alpine package updates, which also refreshes the `-` tag of the current commit; pin by digest (`@sha256:…`) for a byte-for-byte fixed image. The frankenphp images stay on their pinned FrankenPHP version, so a new FrankenPHP release (and the PHP version it ships) still needs `FRANKENPHP_VERSION` bumped in their Dockerfiles. ```sh docker pull ghcr.io/aliasproject/php:8.4-frankenphp @@ -22,7 +22,7 @@ docker pull ghcr.io/aliasproject/php:8.4-frankenphp ## Variants -- **cli** — the PHP CLI with unlimited execution time. 8.3–8.5 are built on the official `php:-cli-alpine` images, so a rebuild picks up the latest php.net patch release (7.4–8.1 still use Alpine's EOL packages). Every image is also rebuilt weekly (Mondays 10:00 UTC), so tags pick up new patch releases without a Dockerfile change. PHP's ini files are in `/usr/local/etc/php` (`conf.d/` for overrides). 8.3–8.5 are identical apart from the PHP version: a minimal extension set (`pdo_mysql`, `bcmath`, `intl`, `pcntl`, `zip`, etc.), a 512M memory limit, and an unprivileged `appuser` in group `0`. Backend and library extensions (`mysqli`, `gd`, `imagick`, `redis`, `igbinary`, …) belong in a derived image such as `php/8.4/cli/Dockerfile.wordpress`. +- **cli** — the PHP CLI with unlimited execution time. 8.3–8.5 are built on the official `php:-cli-alpine` images, so a rebuild picks up the latest php.net patch release (7.4–8.1 still use Alpine's EOL packages). 8.3–8.5 are also rebuilt weekly (Mondays 10:00 UTC), so they pick up new PHP patch releases without a Dockerfile change. PHP's ini files are in `/usr/local/etc/php` (`conf.d/` for overrides). 8.3–8.5 are identical apart from the PHP version: a minimal extension set (`pdo_mysql`, `bcmath`, `intl`, `pcntl`, `zip`, etc.), a 512M memory limit, and an unprivileged `appuser` in group `0`. Backend and library extensions (`mysqli`, `gd`, `imagick`, `redis`, `igbinary`, …) belong in a derived image such as `php/8.4/cli/Dockerfile.wordpress`. - **frankenphp** — FrankenPHP serves PHP directly through Caddy; no separate web server. Minimal extension set, non-root by default, mail sent through `msmtp`, Composer baked in, `HEALTHCHECK` against Caddy's admin API. - **frankenphp (dev)** — the FrankenPHP base with extra extensions (`mysqli`, `gd`, `exif`, `imagick`, `redis`, `igbinary`, `soap`) for local development. - **frankenphp (wordpress)** — the FrankenPHP base with the same extensions as `dev`, plus a hardening policy suited to running WordPress (see below).