docs: support external TLS terminator mode for caddy #34
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 | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GHCR (push only) | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push image (commit SHA) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: dockerfile | |
| push: true | |
| build-args: | | |
| NEXT_PUBLIC_DEBUG=${{ vars.NEXT_PUBLIC_DEBUG }} | |
| tags: | | |
| ghcr.io/adelbeit/jamroom-app:${{ github.sha }} | |
| ghcr.io/adelbeit/jamroom-app:latest | |
| - name: Verify image exists in GHCR | |
| run: docker manifest inspect ghcr.io/adelbeit/jamroom-app:${{ github.sha }} > /dev/null | |
| - name: Deploy to Droplet | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.DROPLET_HOST }} | |
| username: ${{ secrets.DROPLET_USER }} | |
| key: ${{ secrets.DROPLET_SSH_KEY }} | |
| script: | | |
| mkdir -p /opt/jamroom | |
| curl -fsSL https://raw.githubusercontent.com/AdelBeit/jamroom/main/docker-compose.yml -o /opt/jamroom/docker-compose.yml | |
| curl -fsSL https://raw.githubusercontent.com/AdelBeit/jamroom/main/Caddyfile.template -o /opt/jamroom/Caddyfile.template | |
| cd /opt/jamroom | |
| export IMAGE_TAG="${{ github.sha }}" | |
| docker compose pull app | |
| docker compose up -d | |
| - name: Post-deploy health verification | |
| run: | | |
| echo "Waiting for service to be ready..." | |
| for i in {1..30}; do | |
| if curl -sf http://${{ secrets.DROPLET_HOST }}/api/health > /dev/null 2>&1; then | |
| echo "✓ Health check passed" | |
| exit 0 | |
| fi | |
| echo "Attempt $i/30 - waiting for service..." | |
| sleep 2 | |
| done | |
| echo "✗ Health check failed after 30 attempts" | |
| exit 1 |