name: Deploy to Docker on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - name: Deploy via SSH uses: appleboy/ssh-action@v1 with: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USER }} password: ${{ secrets.DEPLOY_PASSWORD }} port: 22 script: | set -e APP_DIR="$HOME/mc-ai-bridge" # First run: clone. Subsequent: pull. if [ ! -d "$APP_DIR/.git" ]; then git clone https://git.silverlabs.uk/SilverLABS/mc-ai-bridge.git "$APP_DIR" else cd "$APP_DIR" git fetch origin main git reset --hard origin/main fi cd "$APP_DIR" # Build and deploy docker compose down --remove-orphans || true docker compose build --no-cache docker compose up -d # Verify container is running sleep 5 docker compose ps echo "--- Health check ---" curl -sf http://localhost:3002/health || echo "Health check not yet available (container may still be starting)"