Files
docker/scripts/docs/render-compose-config.sh
2026-05-13 08:47:23 +10:00

34 lines
917 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
cd "$ROOT"
mkdir -p docs/generated
mapfile -t COMPOSE_FILES < <(scripts/docs/list-compose-files.sh)
if [ "${#COMPOSE_FILES[@]}" -eq 0 ]; then
echo "No compose files found" >&2
exit 1
fi
printf '%s\n' "${COMPOSE_FILES[@]}" > docs/generated/compose-files.txt
if [ ! -x ./services-up.sh ]; then
echo "services-up.sh is missing or not executable" >&2
exit 1
fi
./services-up.sh --profile all config > docs/generated/docker-compose.resolved.yml
service_count="$(
python3 - <<'PY'
import yaml
from pathlib import Path
data = yaml.safe_load(Path("docs/generated/docker-compose.resolved.yml").read_text()) or {}
print(len(data.get("services") or {}))
PY
)"
if [ "$service_count" -eq 0 ]; then
echo "ERROR: rendered compose config contains zero services; check --profile all / COMPOSE_PROFILES." >&2
exit 1
fi