Skip to content

Commit

Permalink
Update public ecr build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
imrkgofficial authored Nov 27, 2024
1 parent 0320a27 commit 95c94df
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build to AWS ECR
name: Build to AWS Public ECR

on: push

Expand All @@ -9,32 +9,28 @@ jobs:
- name: Code Checkout
uses: actions/checkout@v4

- name: Login to AWS
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.REGION }}
build-and-push-pub-ecr:
aws-region: ${{ secrets.PUBLIC_REGION }}

build-and-push-public-ecr:
runs-on: ubuntu-latest
needs: login-to-aws

steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: Login to AWS ECR
uses: docker/login-action@v3
- name: Login to AWS Public ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registry: public.ecr.aws
username: ${{ secrets.ACCESS_KEY }}
password: ${{ secrets.SECRET_ACCESS_KEY }}
env:
aws-region: ${{ secrets.PUBLIC_REGION }}
registry-type: public

- name: Build and Push Image
- name: Build and Push Image to Public ECR
run: |
docker build -t bank .
docker tag bank:latest public.ecr.aws/h8o8x8t1/bank:v2
docker push public.ecr.aws/h8o8x8t1/bank:v2
docker tag bank:latest public.ecr.aws/h8o8x8t1/bank:v3
docker push public.ecr.aws/h8o8x8t1/bank:v3

0 comments on commit 95c94df

Please sign in to comment.