Skip to content

Commit 4df2cdf

Browse files
committed
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
1 parent dc01aa0 commit 4df2cdf

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/dockerimage.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ jobs:
7272
platforms: linux/${{ matrix.platform }}
7373
load: true
7474
tags: ${{ env.IMAGE_NAME }}-${{ env.LATEST_VERSION }}
75+
cache-from: type=gha
76+
cache-to: type=gha,mode=max
7577

7678
- name: Test Image
7779
run: docker run --rm ${{ env.IMAGE_NAME }}-${{ env.LATEST_VERSION }} -e "console.log('Hello from Node.js ' + process.version)"

.github/workflows/update-current-image.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ jobs:
117117
platforms: linux/${{ matrix.platform }}
118118
load: true
119119
tags: ${{ env.IMAGE_NAME }}-${{ needs.check_version.outputs.NODE_VERSION }}
120+
cache-from: type=gha
121+
cache-to: type=gha,mode=max
120122

121123
- name: Test Image
122124
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:
142144
sbom: true
143145
tags: ${{ steps.meta.outputs.tags }}
144146
labels: ${{ steps.meta.outputs.labels }}
147+
cache-from: type=gha
148+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)