ci/cd update #3
This file contains hidden or 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
| # CLUE CD Template | |
| name: FastAPI CD | |
| on: | |
| push: | |
| branches: ["develop"] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: SSH로 EC2에 접속하고 배포하기 | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script_stop: true | |
| script: | | |
| cd clueai || exit 1 | |
| git fetch origin | |
| git checkout develop | |
| git pull origin develop | |
| if [ ! -f .env ]; then | |
| echo "Error: .env file not found in $(pwd)" | |
| echo "Please create .env file based on .env.example" | |
| exit 1 | |
| fi | |
| docker-compose down || true | |
| docker-compose up -d --build | |
| docker image prune -f | |
| sleep 5 | |
| echo "=== Container Status ===" | |
| docker-compose ps | |
| echo "" | |
| echo "=== Recent Logs ===" | |
| docker-compose logs --tail=20 app | |
| echo "" | |
| echo "Deployment completed successfully!" |