From 95f012d24a154c58cfc82586d18c7210aea81244 Mon Sep 17 00:00:00 2001 From: DooHyoJeong Date: Fri, 26 Sep 2025 16:34:57 +0900 Subject: [PATCH] =?UTF-8?q?refactor[cicd]:=20=EB=B0=B0=ED=8F=AC=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI-CD_Pipeline.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI-CD_Pipeline.yml b/.github/workflows/CI-CD_Pipeline.yml index d6bb99bf..f177787d 100644 --- a/.github/workflows/CI-CD_Pipeline.yml +++ b/.github/workflows/CI-CD_Pipeline.yml @@ -225,6 +225,13 @@ jobs: working-directory: / comment: Deploy command: | + set -xe + echo "===== 현재 실행 중인 컨테이너 =====" + docker ps -a || true + + echo "===== 기존 컨테이너 종료 & 제거 =====" + docker stop app1 2>/dev/null || true + docker rm app1 2>/dev/null || true # EC2 내부에서 prod.env 파일 생성 cat > /home/ec2-user/prod.env << 'EOF' SPRING_PROFILES_ACTIVE=prod @@ -254,7 +261,11 @@ jobs: --network common \ -p 8080:8080 \ ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ env.DOCKER_IMAGE_NAME }}:latest - + echo "===== 새 컨테이너 로그 출력 =====" + sleep 5 + docker logs --tail=100 app1 || true + + echo "===== 배포 완료 =====" # dangling image 정리 + .env 삭제 docker rmi $(docker images -f "dangling=true" -q) || true rm -f /home/ec2-user/prod.env \ No newline at end of file