fix: 优化内容
This commit is contained in:
24
dev.sh
24
dev.sh
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user