Skip to content

Commit

Permalink
Update icurri_deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
genius00hwan authored Nov 23, 2024
1 parent 4c19580 commit e14b874
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/icurri_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ jobs:
AWS_REGION: ap-northeast-2

steps:
# AWS 인증 구성
# AWS 자격 증명 설정
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

# Deploy to EC2 (Release Branch)
# SSH로 EC2에 배포
- name: Deploy to EC2 (Release Branch)
if: github.ref == 'refs/heads/release'
uses: appleboy/ssh-action@master
Expand All @@ -106,15 +106,17 @@ jobs:
key: ${{ secrets.RELEASE_SSH_KEY }}
script: |
# 컨테이너 중지 및 제거
sudo docker stop $(sudo docker ps -a -q) || true
sudo docker rm $(sudo docker ps -a -q) || true
sudo docker ps -q | xargs -r sudo docker stop || true
sudo docker ps -aq | xargs -r sudo docker rm || true
# 사용하지 않는 이미지 및 시스템 정리
sudo docker images -q | xargs -r sudo docker rmi || true
sudo docker system prune -af || true
# ECR 로그인 및 이미지 가져오기
# ECR 로그인
aws ecr get-login-password --region ${{ env.AWS_REGION }} | sudo docker login --username AWS --password-stdin ${{ secrets.ECR_URI }}
# Docker 이미지 풀
sudo docker pull ${{ secrets.ECR_URI }}:${{ github.sha }}
# 새 컨테이너 실행
Expand All @@ -125,3 +127,4 @@ jobs:
-p 8080:8080 \
${{ secrets.ECR_URI }}:${{ github.sha }}

0 comments on commit e14b874

Please sign in to comment.