feat: add actions/cache and Docker layer caching
- actions/cache@v4 for node_modules across unit-tests and build jobs - Manual sha256sum key since Gitea lacks hashFiles() support - Docker BuildKit registry-based cache layers (--cache-from/--cache-to) - Both runners configured with their own cache server ports
This commit is contained in:
@@ -109,9 +109,13 @@ jobs:
|
||||
|
||||
- name: Build test-capable image
|
||||
if: steps.commit.outputs.committed == 'true'
|
||||
env:
|
||||
DOCKER_BUILDKIT: 1
|
||||
run: |
|
||||
docker build \
|
||||
--target test-runner \
|
||||
--cache-from type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-test \
|
||||
--cache-to type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-test,mode=max \
|
||||
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||
-t ${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.new_version }} \
|
||||
.
|
||||
@@ -127,9 +131,13 @@ jobs:
|
||||
|
||||
- name: Build production image
|
||||
if: steps.commit.outputs.committed == 'true'
|
||||
env:
|
||||
DOCKER_BUILDKIT: 1
|
||||
run: |
|
||||
docker build \
|
||||
--target runner \
|
||||
--cache-from type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache \
|
||||
--cache-to type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max \
|
||||
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }} \
|
||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
||||
|
||||
Reference in New Issue
Block a user