Skip to content

Commit

Permalink
chore: prod-a, prod-b에 어플리케이션을 배포하도록 변경 (#496)
Browse files Browse the repository at this point in the history
* chore: main branch ci/cd 설정 변경

* chore: 로드 벨런스 대상 포트 변경

* chore: ci/cd deploy 설명 변경

* chore: 포트 번호 변경

* chore: PR 테스트 설정 제거

* chore: 80 포트로 변경

* chore: PR 트리거 제거

* chore: dockerfile 트리거 등록
  • Loading branch information
fromitive committed Nov 28, 2024
1 parent b4d75ee commit 0ff75c7
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/backend-prod-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,30 @@ jobs:
docker tag ${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }} ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}
docker push ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}
deploy:
deploy-a:
needs: build-and-test
runs-on: [ self-hosted, prod ]
runs-on: prod-a

steps:
- name: Pull Image And Restart Container
- name: Pull Image And Restart Container on Production A
run: |
docker login -u ${{ secrets.BE_DOCKERHUB_USERNAME }} -p ${{ secrets.BE_DOCKERHUB_PASSWORD }}
docker stop ${{ secrets.BE_DOCKER_CONTAINER_NAME }} | true
docker rm ${{ secrets.BE_DOCKER_CONTAINER_NAME }} | true
docker image prune -a -f
docker pull ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}
docker run --name ${{ secrets.BE_DOCKER_CONTAINER_NAME }} --network nginx_network -d -v /logs:/logs -e SPRING_PROFILES_ACTIVE=prod ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}
docker run --name ${{ secrets.BE_DOCKER_CONTAINER_NAME }} -d -v /logs:/logs -p 80:8080 -e SPRING_PROFILES_ACTIVE=prod ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}
deploy-b:
needs: build-and-test
runs-on: prod-b

steps:
- name: Pull Image And Restart Container on Production B
run: |
docker login -u ${{ secrets.BE_DOCKERHUB_USERNAME }} -p ${{ secrets.BE_DOCKERHUB_PASSWORD }}
docker stop ${{ secrets.BE_DOCKER_CONTAINER_NAME }} | true
docker rm ${{ secrets.BE_DOCKER_CONTAINER_NAME }} | true
docker image prune -a -f
docker pull ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}
docker run --name ${{ secrets.BE_DOCKER_CONTAINER_NAME }} -d -v /logs:/logs -p 80:8080 -e SPRING_PROFILES_ACTIVE=prod ${{ secrets.BE_DOCKERHUB_USERNAME }}/${{ secrets.BE_DOCKER_IMAGE_NAME_PROD }}:${GITHUB_SHA::7}

0 comments on commit 0ff75c7

Please sign in to comment.