feat: add github action #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image to ECR | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
region: ${{ secrets.AWS_REGION }} | |
access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Build, tag, and push Docker image | |
env: | |
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }} | |
IMAGE_TAG: latest | |
run: | | |
# Build the Docker image | |
docker build -t $ECR_REPOSITORY:$IMAGE_TAG . | |
# Push the image to ECR | |
docker push $ECR_REPOSITORY:$IMAGE_TAG |