fix: dockercompose파일 위치 변경 #58
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
| name: Deploy with Docker Compose | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up SSH private key | |
| run: | | |
| echo "${{ secrets.SSH_KEY }}" > private_key.pem | |
| chmod 600 private_key.pem | |
| - name: Generate .env for Docker Compose | |
| run: | | |
| echo "AZURE_DB_USERNAME=${{ secrets.AZURE_DB_USERNAME }}" >> .env | |
| echo "AZURE_DB_PASSWORD=${{ secrets.AZURE_DB_PASSWORD }}" >> .env | |
| echo "GEMINI_KEY=${{ secrets.GEMINI_KEY }}" >> .env | |
| echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> .env | |
| echo "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}" >> .env | |
| echo "JWT_ACCESS_TOKEN_TIME=${{ secrets.JWT_ACCESS_TOKEN_TIME }}" >> .env | |
| echo "JWT_REFRESH_TOKEN_TIME=${{ secrets.JWT_REFRESH_TOKEN_TIME }}" >> .env | |
| echo "GITHUB_CLIENT_ID=${{ secrets.GITHUB_CLIENT_ID }}" >> .env | |
| echo "GITHUB_CLIENT_SECRET=${{ secrets.GITHUB_CLIENT_SECRET }}" >> .env | |
| - name: Upload docker-compose.yml to Azure VM | |
| run: | | |
| scp -i private_key.pem -o StrictHostKeyChecking=no docker-compose.yml ${{ secrets.AZURE_VM_USER }}@${{ secrets.AZURE_VM_HOST }}:/home/ubuntu/fossistant/docker-compose.yml | |
| - name: Upload .env to Azure VM | |
| run: | | |
| scp -i private_key.pem -o StrictHostKeyChecking=no .env ${{ secrets.AZURE_VM_USER }}@${{ secrets.AZURE_VM_HOST }}:/home/ubuntu/fossistant/.env | |
| - name: SSH to Azure VM and Deploy | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.AZURE_VM_HOST }} | |
| username: ${{ secrets.AZURE_VM_USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| port: 22 | |
| script: | | |
| cd /home/ubuntu/fossistant | |
| echo "✅ pulling latest image..." | |
| docker compose pull | |
| echo "🧹 stopping old containers..." | |
| docker compose down || true | |
| echo "🚀 starting new containers..." | |
| docker compose up -d --build |