@@ -10,10 +10,6 @@ permissions:
1010 contents : read
1111
1212jobs :
13- # ─────────────────────────────────────────────
14- # 1) Build-and-Push-Image Job
15- # - Gradle 빌드 → Docker 이미지 빌드 → Docker Hub Push
16- # ─────────────────────────────────────────────
1713 build-and-push-image :
1814 name : Build & Push Docker Image
1915 runs-on : ubuntu-latest
4642 - name : Push Docker Image to Docker Hub
4743 run : docker push ${{ secrets.DOCKER_USERNAME }}/fossistant:latest
4844
49- # ─────────────────────────────────────────────
50- # 2) Deploy-with-Compose Job
51- # - “Build”가 끝나면 Azure VM에 SSH 접속 → Compose로 배포
52- # ─────────────────────────────────────────────
5345 deploy-with-compose :
5446 name : Deploy to Azure VM via Docker Compose
5547 runs-on : ubuntu-latest
@@ -108,28 +100,22 @@ EOF
108100
109101 cd /home/ubuntu/fossistant
110102
111- # 1) 호스트에 시스템 Redis가 있다면 중지 (서비스 이름이 다를 수 있으니 상황에 맞게 수정)
112103 echo "🛑 Stopping host's Redis service if running..."
113104 sudo systemctl stop redis-server || true
114105
115- # 2) 호스트 포트 6379를 점유한 모든 프로세스 강제 종료
116106 echo "🧼 Killing any process listening on port 6379..."
117107 sudo fuser -k 6379/tcp || true
118108
119- # 3) 기존 컨테이너 강제 제거
120109 echo "🧼 Forcibly removing any existing containers named 'redis' or 'fossistant'..."
121110 docker rm -f redis fossistant || true
122111
123- # 4) Compose로 띄웠던 컨테이너·네트워크 정리
124112 echo "🧹 Stopping old containers and removing orphans..."
125113 sudo docker compose down --remove-orphans || true
126114 sudo docker compose rm -f || true
127115
128- # 5) 최신 이미지 Pull
129116 echo "✅ Pulling latest images from Docker Hub..."
130117 sudo docker compose pull
131118
132- # 6) 새 컨테이너 기동
133119 echo "🚀 Starting new containers with Docker Compose..."
134120 sudo docker compose up -d --build
135121
0 commit comments