From 4df2cdfb6c4b8b751a2998db8d80d8f297ba62e1 Mon Sep 17 00:00:00 2001 From: Christopher Horrell Date: Tue, 17 Feb 2026 20:43:09 -0500 Subject: [PATCH] Add Docker layer caching to improve build performance Implements GitHub Actions cache backend (type=gha) for Docker layer caching in both workflows: **update-current-image.yml:** - Added cache-from: type=gha to both 'Build' and 'Build and push Image' steps - Added cache-to: type=gha,mode=max to store full cache for reuse **dockerimage.yml:** - Added cache-from: type=gha to 'Build Image' step - Added cache-to: type=gha,mode=max for caching Docker layers **Benefits:** - Reuses Docker layers across builds - Significantly faster builds when layers haven't changed - No external infrastructure needed (uses GitHub Actions cache) - Cache is scoped per workflow run context --- .github/workflows/dockerimage.yml | 2 ++ .github/workflows/update-current-image.yml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index e140eb0..d3c3038 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -72,6 +72,8 @@ jobs: platforms: linux/${{ matrix.platform }} load: true tags: ${{ env.IMAGE_NAME }}-${{ env.LATEST_VERSION }} + cache-from: type=gha + cache-to: type=gha,mode=max - name: Test Image run: docker run --rm ${{ env.IMAGE_NAME }}-${{ env.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 a4aa92e..e8e49bc 100644 --- a/.github/workflows/update-current-image.yml +++ b/.github/workflows/update-current-image.yml @@ -117,6 +117,8 @@ jobs: platforms: linux/${{ matrix.platform }} load: true tags: ${{ env.IMAGE_NAME }}-${{ needs.check_version.outputs.NODE_VERSION }} + cache-from: type=gha + cache-to: type=gha,mode=max - name: Test Image run: docker run --rm ${{ env.IMAGE_NAME }}-${{ needs.check_version.outputs.NODE_VERSION }} -e "console.log('Hello from Node.js ' + process.version)" @@ -142,3 +144,5 @@ jobs: sbom: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max