Skip to content

feat: add github action #1

feat: add github action

feat: add github action #1

Workflow file for this run

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