Skip to content

Commit

Permalink
chore : main branch에 merge할 때 배포 되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
byeolhaha committed Jun 3, 2024
1 parent 71228cc commit 30558cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ jobs:
if: contains(github.ref, 'main')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/hello-counsellor .
docker push ${{ secrets.DOCKER_USERNAME }}/hello-counsellor
- name: Deploy to prod
uses: appleboy/ssh-action@master
Expand Down
24 changes: 1 addition & 23 deletions .github/workflows/develop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,4 @@ jobs:
run: ./gradlew clean

- name: Build with gradle
run: ./gradlew build

- name: Docker build & push to prod
if: contains(github.ref, 'main')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/hello-counsellor .
docker push ${{ secrets.DOCKER_USERNAME }}/hello-counsellor
- name: Deploy to prod
uses: appleboy/ssh-action@master
id: deploy-prod
if: contains(github.ref, 'main')
with:
host: ${{ secrets.HOST_PROD }} # EC2 퍼블릭 IPv4 DNS
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
envs: GITHUB_SHA
script: |
sudo docker ps
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/hello-counsellor
sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/hello-counsellor
sudo docker image prune -f
run: ./gradlew build

0 comments on commit 30558cf

Please sign in to comment.