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