#!/usr/bin/env bash # deploy.sh — Manual redeploy on an existing Docker server. # Normally Woodpecker CI handles deploys automatically on push to main or tag. # Use this script only for manual/emergency redeploys. # Usage: bash deploy/deploy.sh [--from-registry] # --from-registry Pull the pre-built image from registry instead of building locally set -euo pipefail APP_DIR="$(cd "$(dirname "$0")/.." && pwd)" cd "$APP_DIR" FROM_REGISTRY=false [[ "${1:-}" == "--from-registry" ]] && FROM_REGISTRY=true echo "==> Pulling latest code" git pull --ff-only if $FROM_REGISTRY; then echo "==> Pulling pre-built image from registry" docker compose pull bridge else echo "==> Building image locally" docker compose build --no-cache bridge fi echo "==> Restarting services" docker compose up -d --remove-orphans echo "==> Waiting for health check" sleep 5 docker compose ps bridge docker compose logs --tail=20 bridge echo "" echo "=== Deploy complete ===" echo "Health endpoint: https://hl.cast.ph/health"