From 1261339b0f68471e6cc40a2f6307ec6d3b5fbbf2 Mon Sep 17 00:00:00 2001 From: deveunhwa Date: Wed, 6 Nov 2024 04:38:35 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20docker-compose=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CICD.yml | 29 +++++++++++++++++++---------- docker-compose.yml | 22 +++++++++++++++++----- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index b95ff0a..ac9752d 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -106,13 +106,22 @@ jobs: sudo systemctl reload nginx # Blue-Green 설정 Docker Compose 실행 - - name: Deploy with Docker Compose on EC2 - uses: appleboy/ssh-action@v0.1.6 - with: - host: ${{ secrets.EC2_HOST }} - username: ${{ secrets.EC2_USER }} - key: ${{ secrets.EC2_SSH_KEY }} - script: | - cd ~/bitta-front - docker-compose down - docker-compose up -d + - name: Deploy with Docker Compose on EC2 + uses: appleboy/ssh-action@v0.1.6 + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + key: ${{ secrets.EC2_SSH_KEY }} + script: | + cd ~/bitta-project + docker-compose down + docker-compose up -d --no-deps + sudo nginx -s reload + + # test + - name: Test Frontend Response + run: curl --fail http://${{ secrets.EC2_HOST }} || exit 1 + + - name: Test Backend Response + run: curl --fail http://${{ secrets.EC2_HOST }}/api/ || exit 1 + diff --git a/docker-compose.yml b/docker-compose.yml index b448ef0..e82540b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,29 @@ version: '3' services: - backend: - container_name: backend-blue + frontend-blue: + image: publicdeveh/bitta-front:latest + ports: + - "3001:3000" + environment: + - NODE_ENV=production + + frontend-green: + image: publicdeveh/bitta-front:latest + ports: + - "3002:3000" + environment: + - NODE_ENV=production + + backend-blue: image: publicdeveh/bitta-kotlin:latest ports: - "8081:8000" environment: - SPRING_PROFILES_ACTIVE=prod - backend_alternate: - container_name: backend-green + backend-green: image: publicdeveh/bitta-kotlin:latest ports: - "8082:8000" environment: - - SPRING_PROFILES_ACTIVE=prod \ No newline at end of file + - SPRING_PROFILES_ACTIVE=prod