File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Docker Image to AWS ECR Private
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+ jobs :
9+ build :
10+ name : Build and push Docker image
11+ runs-on : ubuntu-latest
12+ environment : certified-builder-py
13+ steps :
14+ - name : Checkout Repository
15+ uses : actions/checkout@v4
16+
17+ - name : Configure AWS credentials
18+ uses : aws-actions/configure-aws-credentials@v4
19+ with :
20+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
21+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
22+ aws-region : us-east-1
23+ audience : sts.amazonaws.com
24+
25+ - name : Login to Amazon ECR Private
26+ run : aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com
27+
28+ - name : Build Docker image
29+ run : |
30+ docker build -t ${{ secrets.ECR_REPOSITORY_API }}:latest .
31+ docker tag ${{ secrets.ECR_REPOSITORY_API }}:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_API }}:latest
32+
33+ - name : Push Docker image
34+ run : |
35+ docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_API }}:latest
36+
37+ - name : Update Lambda function
38+ run : |
39+ aws lambda update-function-code \
40+ --function-name tech-floripa-certified-api-dev \
41+ --image-uri ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_API }}:latest
42+
43+ - name : Complete
44+ run : |
45+ echo "Docker image has been pushed to AWS ECR Private and Lambda function has been updated"
You can’t perform that action at this time.
0 commit comments