Skip to content

Commit a4a4062

Browse files
committed
Add workflow to deploy Docker image to AWS ECR public repository
1 parent c330d91 commit a4a4062

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/amazon-ecr.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Push the Docker image to AWS ECR Repo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
Build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@v1
18+
with:
19+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
20+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
21+
aws-region: ap-south-1
22+
23+
- name: Login to Amazon ECR
24+
id: login-ecr
25+
uses: aws-actions/amazon-ecr-login@v1
26+
27+
- name: Build, tag, and push the image to Amazon ECR
28+
id: build-image
29+
run: |
30+
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r9h8b0z6
31+
docker build -t public.ecr.aws/r9h8b0z6/cryptgeon:latest .
32+
docker push public.ecr.aws/r9h8b0z6/cryptgeon:latest

0 commit comments

Comments
 (0)