fix(ops): wait for production container startup

This commit is contained in:
134 2026-08-20 19:52:05 +08:00
parent f0a24a1a99
commit 1d84b1b1c0

View File

@ -37,8 +37,18 @@ candidate_dir=""
docker compose -f "${compose_dir}/docker-compose.yml" up -d app
if ! curl -fsS --retry 12 --retry-delay 2 --max-time 10 \
http://127.0.0.1:3125/login >/dev/null; then
health_ok=false
attempt=1
while [ "$attempt" -le 15 ]; do
if curl -fsS --max-time 10 http://127.0.0.1:3125/login >/dev/null; then
health_ok=true
break
fi
sleep 2
attempt=$((attempt + 1))
done
if [ "$health_ok" != true ]; then
docker stop ai-chatbot-app >/dev/null 2>&1 || true
docker rm ai-chatbot-app >/dev/null 2>&1 || true
failed_dir="${app_dir}/.next-failed-$(date +%Y%m%dT%H%M%S)"