Skip to content

Commit 51f7360

Browse files
committed
[CICD] 기존 포트 확인 및 종료 후 재시도 스크립트 추가
1 parent ee6caad commit 51f7360

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,18 @@ jobs:
108108
ssh -o StrictHostKeyChecking=no -T -i ~/.ssh/id_rsa ubuntu@${{ secrets.EC2_PUBLIC_IP }} << 'EOF'
109109
aws ecr get-login-password --region ${{ env.AWS_REGION }} | sudo docker login --username AWS --password-stdin $(aws ecr describe-repositories --repository-names ${{ env.ECR_REPOSITORY }} --query "repositories[0].repositoryUri" --output text)
110110
111-
# 기존 프로세스 확인 및 종료
112111
if sudo lsof -i:8080; then
113112
echo "Port 8080 is in use. Stopping process..."
114113
sudo kill -9 $(sudo lsof -t -i:8080) || true
115114
else
116115
echo "Port 8080 is free."
117116
fi
118117
119-
# Docker 이미지 Pull
120118
sudo docker pull $(aws ecr describe-repositories --repository-names ${{ env.ECR_REPOSITORY }} --query "repositories[0].repositoryUri" --output text):${{ github.sha }}
121119
122-
# 기존 컨테이너 중지 및 제거
123120
sudo docker stop ${{ env.DOCKER_IMAGE_NAME }} || true
124121
sudo docker rm ${{ env.DOCKER_IMAGE_NAME }} || true
125122
126-
# 새 컨테이너 실행
127123
sudo docker run -d -p 8080:8080 --name ${{ env.DOCKER_IMAGE_NAME }} $(aws ecr describe-repositories --repository-names ${{ env.ECR_REPOSITORY }} --query "repositories[0].repositoryUri" --output text):${{ github.sha }}
128124
EOF
129125

0 commit comments

Comments
 (0)