41 lines
1.1 KiB
Bash
41 lines
1.1 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
ROOT_DIR="/host/var/lib/xiaoxia-saas-production/repo"
|
|
COMPOSE_DIR="$ROOT_DIR/infra/docker"
|
|
ENV_FILE="/host/var/lib/xiaoxia-saas-production/.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"
|
|
[ -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
|