Skip to content

Commit

Permalink
chore: ECR 기반 지속적 배포 파이프라인
Browse files Browse the repository at this point in the history
  • Loading branch information
h-beeen committed Mar 12, 2024
1 parent f995baa commit b87cef5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,16 @@ jobs:
docker build -t vacgom:${{steps.current-time.outputs.formattedTime}} .
docker tag vacgom:${{steps.current-time.outputs.formattedTime}} ${{ secrets.ECR_URI }}:${{steps.current-time.outputs.formattedTime}}
docker push ${{ secrets.ECR_URI }}:${{steps.current-time.outputs.formattedTime}}
- name: SSH into EC2 instance
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
port: ${{ secrets.EC2_SSH_PORT }}
script: |
docker pull ${{ secrets.ECR_URI }}:${{ steps.current-time.outputs.formattedTime }}
docker ps -f name=vacgom-api -q | xargs --no-run-if-empty docker container stop
docker ps -a -f name=vacgom-api -q | xargs --no-run-if-empty docker container rm
docker run -d --name vacgom-api -p 80:8080 ${{ secrets.AWS_ECR_REPO_URI }}:${{ steps.current-time.outputs.formattedTime }}

0 comments on commit b87cef5

Please sign in to comment.