Skip to content

Commit 3bdf5a2

Browse files
committed
Improve workflows with caching
1 parent 77cccd4 commit 3bdf5a2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/azure-acr-deploy-frontend-dev.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ jobs:
2626
username: ${{ secrets.ACR_USERNAME }}
2727
password: ${{ secrets.ACR_PASSWORD }}
2828

29-
- name: Build and push :development
29+
- name: Build and push image (with ACR cache)
3030
uses: docker/build-push-action@v6
3131
with:
3232
context: ./frontend
3333
file: ./frontend/Dockerfile.dev
3434
push: true
35-
tags: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:development
35+
tags: |
36+
${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:development
37+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:buildcache
38+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:buildcache,mode=max
3639

3740
deploy:
3841
needs: build-and-push

.github/workflows/azure-acr-deploy-frontend-prod.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
VERSION="v$(date +'%Y.%m.%d')-${GITHUB_RUN_NUMBER}"
3333
echo "version=$VERSION" >> $GITHUB_OUTPUT
3434
35-
- name: Build and push :production and versioned tags
35+
- name: Build and push :production and versioned tags (with ACR cache)
3636
uses: docker/build-push-action@v6
3737
with:
3838
context: ./frontend
@@ -41,6 +41,8 @@ jobs:
4141
tags: |
4242
${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:production
4343
${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:${{ steps.vars.outputs.version }}
44+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:buildcache
45+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}:buildcache,mode=max
4446

4547
deploy:
4648
needs: build-and-push

0 commit comments

Comments
 (0)