Merge pull request #202 from yuminn-k/main #49
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: Deploy to ECR and ECS | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
name: Build Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
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: ap-northeast-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
run: | | |
docker build -t minori-next . | |
docker tag minori-next:latest 233629834663.dkr.ecr.ap-northeast-2.amazonaws.com/minori-next:latest | |
docker push 233629834663.dkr.ecr.ap-northeast-2.amazonaws.com/minori-next:latest | |
- name: Update ECS service | |
run: | | |
aws ecs update-service --cluster minori-next-cluster --service minori-frontend --force-new-deployment | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ap-northeast-2 |