TOONPICK Backend CD Pipeline #16
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 pull $DOCKER_HUB_USERNAME/toonpick-service-app:latest | |
docker-compose up -d | |