fix: auto-install docker compose plugin on droplet #6
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 to DigitalOcean | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| name: Deploy to Droplet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy via SSH | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.DO_HOST }} | |
| username: ${{ secrets.DO_USER }} | |
| key: ${{ secrets.DO_SSH_KEY }} | |
| script: | | |
| set -e | |
| echo "📦 Pulling latest code..." | |
| cd /root/Thought-Processor | |
| git fetch origin main | |
| git reset --hard origin/main | |
| echo "🔧 Ensuring Docker Compose is installed..." | |
| if ! docker compose version > /dev/null 2>&1; then | |
| apt-get update && apt-get install -y docker-compose-plugin | |
| fi | |
| echo "🏗️ Building containers..." | |
| docker compose build | |
| echo "🔄 Restarting stack..." | |
| docker compose down | |
| docker compose up -d | |
| echo "⏳ Waiting for health checks..." | |
| sleep 10 | |
| echo "✅ Checking service status..." | |
| docker compose ps | |
| echo "🎉 Deployment complete!" |