fix: 优化内容

This commit is contained in:
Daniel
2026-03-25 13:33:48 +08:00
parent f99098ec58
commit 8991f2a2d7
14 changed files with 1417 additions and 277 deletions

24
dev.sh
View File

@@ -18,7 +18,29 @@ shift || true
case "$CMD" in
up)
docker compose up --build "$@"
# Start in background, then wait for Node self-check + health endpoint.
docker compose up -d --build "$@"
echo "[dev] waiting for server health..."
deadline=$((SECONDS + 90))
ok=0
while [ $SECONDS -lt $deadline ]; do
if curl -fsS "http://127.0.0.1:3000/api/health" >/dev/null 2>&1; then
ok=1
break
fi
# If container exited, fail fast.
if ! docker compose ps --status running | grep -q "aivideo"; then
break
fi
sleep 1
done
if [ "$ok" -ne 1 ]; then
echo "[dev] server failed to become healthy (self-check likely failed)." >&2
docker compose logs --tail=200 aivideo || true
exit 1
fi
echo "[dev] server ready: http://127.0.0.1:3000"
docker compose logs -f --tail=50 aivideo
;;
rebuild)
docker compose build "$@"