Skip to content

Commit

Permalink
Create aws-ecr.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 authored Jun 6, 2024
1 parent f7fe3e9 commit 544fdc3
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/aws-ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: MongoDB AWS

on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]

env:
AWS_REGION: us-east-1
ECR_REPOSITORY: agora/db
IMAGE_TAG: ${{ github.sha }}

jobs:
build-and-push:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

0 comments on commit 544fdc3

Please sign in to comment.