Skip to content

Commit f1881e9

Browse files
committed
ci: Use caching action directly from docker
1 parent 85de638 commit f1881e9

File tree

1 file changed

+10
-33
lines changed

1 file changed

+10
-33
lines changed

.github/workflows/aws-backend-deploy.yml

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,40 +57,17 @@ jobs:
5757
- name: Login to Amazon ECR
5858
id: login-ecr
5959
uses: aws-actions/amazon-ecr-login@v1
60-
- name: Init Docker Cache
61-
uses: jpribyl/[email protected]
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
- name: Build and push Docker image with registry cache
63+
uses: docker/build-push-action@v5
6264
with:
63-
key: ${{ github.workflow }}-2-{hash}
64-
restore-keys: |
65-
${{ github.workflow }}-2-
66-
- name: Docker Layer Caching (retry on cache failure)
67-
uses: jpribyl/[email protected]
68-
with:
69-
key: Backend Build and Deploy-2-${{ hashFiles('backend/Dockerfile.prod') }}
70-
restore-keys: Backend Build and Deploy-2-
71-
concurrency: 4
72-
skip-save: false
73-
env:
74-
AWS_SHARED_CLUSTER: incubator-prod
75-
AWS_APP_NAME: vrms-backend
76-
AWS_REGION: us-west-2
77-
DOCKERFILE: backend/Dockerfile.prod
78-
DOCKER_PATH: backend
79-
AWS_DEFAULT_REGION: us-west-2
80-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
81-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
82-
continue-on-error: true
83-
- name: Build & Push Image to ECR
84-
uses: kciter/aws-ecr-action@v3
85-
with:
86-
access_key_id: ${{ secrets.INCUBATOR_AWS_ACCESS_KEY_ID }}
87-
secret_access_key: ${{ secrets.INCUBATOR_AWS_SECRET_ACCESS_KEY }}
88-
account_id: ${{ secrets.INCUBATOR_AWS_ACCOUNT_ID }}
89-
repo: ${{ needs.setup_env.outputs.AWS_APPENV }}
90-
region: ${{ env.AWS_REGION }}
91-
tags: latest,${{ needs.setup_env.outputs.IMAGE_TAG }}
92-
dockerfile: ${{ env.DOCKERFILE }}
93-
path: ${{ env.DOCKER_PATH }}
65+
context: .
66+
push: true
67+
tags: ${{ steps.login-ecr.outputs.registry }}/${{ needs.setup_env.outputs.AWS_APPENV }}:${{ needs.setup_env.outputs.IMAGE_TAG }}
68+
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/${{ needs.setup_env.outputs.AWS_APPENV }}:buildcache
69+
cache-to: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/${{ needs.setup_env.outputs.AWS_APPENV }}:buildcache,mode=max
70+
file: ${{ env.DOCKERFILE }}
9471
deploy:
9572
name: Deploy to AWS ECS
9673
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)