TOONPICK Backend CD Pipeline #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TOONPICK Backend CD Pipeline | |
on: | |
workflow_run: | |
workflows: ["TOONPICK Backend CI Pipeline"] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: EC2에 SSH 접속하여 배포 실행 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
# Secrets에서 환경 변수 가져오기 | |
export DOCKER_HUB_USERNAME="${{ secrets.DOCKER_HUB_USERNAME }}" | |
export DOCKER_HUB_PASSWORD="${{ secrets.DOCKER_HUB_PASSWORD }}" | |
cd ~/TOONPICK | |
echo "최신 Docker Image Pull & 배포 시작..." | |
docker stop toonpick-service-app || true | |
docker rm toonpick-service-app || true | |
docker pull $DOCKER_HUB_USERNAME/toonpick-service-app:latest | |
docker-compose up -d --no-deps --build spring-app | |