Skip to content

Commit

Permalink
Merge pull request #226 from SWM-NM/dev
Browse files Browse the repository at this point in the history
🐛 [FIX] ECR push 오류 해결 #220
  • Loading branch information
miiiinju1 authored Sep 3, 2023
2 parents cc395f8 + e7246b7 commit d71e968
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ on:
env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: morandi-backend
ECR_REGISTRY: public.ecr.aws/s7z8j0e6/morandi-backend
EC2_HOST: 3.38.102.140
GITHUB_SHA: ${{ github.sha }}


permissions:
contents: read
Expand Down Expand Up @@ -51,11 +54,11 @@ jobs:
uses: aws-actions/amazon-ecr-login@v1

- name: Build and Push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.ECR_REPOSITORY }}:${{ github.sha }}
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{env.GITHUB_SHA}}

- name: appleboy SSH and Deploy to EC2
uses: appleboy/[email protected] # ssh 접속하는 오픈소스
Expand All @@ -64,13 +67,14 @@ jobs:
username: ubuntu
key: ${{ secrets.SSH_SECRET_ACCESS_KEY }}
port: 22
script: |
script: |
export TAG=${{env.GITHUB_SHA}}
cd /home/ubuntu/morandi-backend
docker-compose down

# ECR에서 이미지 가져오기
docker pull ${ECR_REPOSITORY}:latest
docker pull ${ECR_REPOSITORY}:${TAG}

docker-compose up -d

Expand Down

0 comments on commit d71e968

Please sign in to comment.