From b1d990a0c445159e953d47db6707307c26793ae7 Mon Sep 17 00:00:00 2001 From: Christopher Horrell Date: Mon, 25 May 2026 23:11:16 -0400 Subject: [PATCH] ci: add Docker buildx GHA layer cache to build workflows Caches Docker build layers in GitHub Actions cache (type=gha) scoped per platform. The second build-push-action call in the update workflow (push step) now reuses layers warmed by the test-image step, making the push build effectively free for this scratch-based image and future-proofing for any Dockerfile growth. --- .github/workflows/dockerimage.yml | 2 ++ .github/workflows/update-current-image.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 7f5bcf4..7196921 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -81,6 +81,8 @@ jobs: platforms: linux/${{ matrix.platform }} load: true tags: ${{ env.IMAGE_NAME }}-${{ env.LATEST_VERSION }} + cache-from: type=gha,scope=${{ matrix.platform }} + cache-to: type=gha,mode=max,scope=${{ matrix.platform }} - name: Test Image run: docker run --rm "${IMAGE_NAME}-${LATEST_VERSION}" -e "console.log('Hello from Node.js ' + process.version)" diff --git a/.github/workflows/update-current-image.yml b/.github/workflows/update-current-image.yml index c4b5c03..ee03b04 100644 --- a/.github/workflows/update-current-image.yml +++ b/.github/workflows/update-current-image.yml @@ -137,6 +137,8 @@ jobs: platforms: linux/${{ matrix.platform }} load: true tags: ${{ env.IMAGE_NAME }}-${{ env.NODE_VERSION }} + cache-from: type=gha,scope=${{ matrix.platform }} + cache-to: type=gha,mode=max,scope=${{ matrix.platform }} - name: Test Image run: docker run --rm "${IMAGE_NAME}-${NODE_VERSION}" -e "console.log('Hello from Node.js ' + process.version)" @@ -152,6 +154,7 @@ jobs: tags: | ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:build-${{ github.run_id }}-${{ matrix.platform }} ${{ env.GHCR_IMAGE }}:build-${{ github.run_id }}-${{ matrix.platform }} + cache-from: type=gha,scope=${{ matrix.platform }} merge: needs: [check_version, build]