Some checks failed
Deploy XIP / deploy (push) Failing after 35s
Sans --env-file, l'interpolation ${POSTGRES_PASSWORD:?} echoue et fait sortir
deploy.sh en non-zero (set -e) -> le job CI serait marque en echec a tort.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
777 B
Bash
27 lines
777 B
Bash
#!/usr/bin/env bash
|
|
# Pull the latest main and (re)build the XIP stack on the deploy host.
|
|
# Invoked over SSH by the Gitea Actions workflow on every push to main,
|
|
# and runnable by hand on the CT for manual redeploys.
|
|
set -euo pipefail
|
|
|
|
APP_DIR="${XIP_APP_DIR:-/opt/xip}"
|
|
COMPOSE_FILE="docker-compose.prod.yml"
|
|
ENV_FILE=".env.prod"
|
|
|
|
cd "$APP_DIR"
|
|
|
|
echo "==> Fetching latest origin/main…"
|
|
git fetch --all --prune
|
|
git reset --hard origin/main
|
|
|
|
echo "==> Building + starting the stack…"
|
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" up -d --build --remove-orphans
|
|
|
|
echo "==> Pruning dangling images…"
|
|
docker image prune -f >/dev/null 2>&1 || true
|
|
|
|
echo "==> Current state:"
|
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" ps
|
|
|
|
echo "==> Deploy complete."
|