Skip to content

Commit

Permalink
Merge pull request #18 from Goldchae/main
Browse files Browse the repository at this point in the history
fix : 디스크 공간 문제
  • Loading branch information
Goldchae authored Nov 13, 2024
2 parents 4639da0 + f222072 commit d888240
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
push: true
tags: ${{ env.DOCKER_IMAGE }}:latest, ${{ env.DOCKER_IMAGE }}:${{ github.sha }}

# 도커 이미지 EC2 인스턴스에 배포
# Docker 이미지 EC2 인스턴스에 배포
deploy_to_ec2:
needs: build-and-push-docker
runs-on: ubuntu-latest
Expand All @@ -41,12 +41,19 @@ jobs:
username: ${{ secrets.EC2_USER }} # EC2 사용자
key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} # pem 키

# 기존 컨테이너 중지
script: |
# 최신 이미지 풀
if ! docker pull ${{ env.DOCKER_IMAGE }}:latest; then
echo "Failed to pull the latest image."
exit 1
fi
# 사용하지 않는 도커 자원 정리
docker system prune -af --volumes
# 기존 컨테이너 중지 및 제거
docker stop qup-frontend || true
docker rm qup-frontend || true
# 새 컨테이너 실행
docker run -d --name qup-frontend -p 80:3000 ${{ env.DOCKER_IMAGE }}:latest

0 comments on commit d888240

Please sign in to comment.