All checks were successful
Deploy to Docker / deploy (push) Successful in 17s
Deploys to 10.0.0.247 via SSH on push to main. Clones on first run, pulls on subsequent. Builds Docker image and runs docker compose up. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
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)"
|