Files
xiaoxia-saas/infra/docker/deploy-staging.sh
T
Xiaoxia AI a988f5935a
CI/CD Pipeline / Validate Code Quality And Tests (push) Successful in 56s
Deploy / Deploy Staging (push) Successful in 1m12s
Deploy / Deploy Production (push) Has been skipped
fix(deploy): expose generated video files
2026-06-20 23:40:47 +08:00

41 lines
1.1 KiB
Bash

#!/bin/sh
set -eu
ROOT_DIR="/host/var/lib/xiaoxia-saas-staging/repo"
COMPOSE_DIR="$ROOT_DIR/infra/docker"
ENV_FILE="/host/var/lib/xiaoxia-saas-staging/.env"
ensure_container_running() {
name="$1"
if ! docker inspect "$name" >/dev/null 2>&1; then
echo "❌ Required infrastructure container not found: $name"
echo " Run infra/docker/infra.yml first before deploying applications."
exit 1
fi
state="$(docker inspect -f '{{.State.Status}}' "$name")"
if [ "$state" != "running" ]; then
echo "❌ Required infrastructure container is not running: $name ($state)"
exit 1
fi
}
cd "$ROOT_DIR"
cp "$ENV_FILE" "$ROOT_DIR/.env"
mkdir -p "$ROOT_DIR/apps/web/public" /host/var/lib/xiaoxia-saas-staging/generated
[ -f "$ROOT_DIR/apps/web/public/.keep" ] || printf 'placeholder' > "$ROOT_DIR/apps/web/public/.keep"
ensure_container_running xiaoxia-postgres
ensure_container_running xiaoxia-redis
cd "$COMPOSE_DIR"
WEB_PORT="${WEB_PORT:-3001}"
export WEB_PORT
export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0
docker compose build --pull=false api
docker compose build --pull=false worker
docker compose up -d api worker web
docker compose ps