Skip to content

Commit

Permalink
Update server-cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
zzawang authored May 27, 2024
1 parent 8ba9445 commit 7a2b387
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/server-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ jobs:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
run: |
cd /home/ubuntu
script: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest
# 기존에 실행 중인 컨테이너 중지 및 삭제
if [ $(sudo docker ps -q -f name=spring-server) ]; then
sudo docker stop spring-server
sudo docker rm spring-server
fi
# 새로운 컨테이너 실행
sudo docker run -d -p 8080:8080 --name spring-server ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest
sudo docker-compose up -d

0 comments on commit 7a2b387

Please sign in to comment.