fix: 修复前端访问错误

This commit is contained in:
Daniel
2026-04-12 20:18:09 +08:00
parent 0bf00fcfae
commit 15e71a9231
4 changed files with 43 additions and 5 deletions

View File

@@ -18,8 +18,24 @@ else
echo "==> AI 配置来自 .env.example请填写 QWEN_API_KEY亦可复制为 .env 再填写)"
fi
echo "==> 健康检查(端口与 docker-compose.yml 一致:后端 8866前端 Nginx 8173"
echo "backend: $(curl -sf http://localhost:8866/health || echo 'unreachable')"
echo "frontend (nginx): $(curl -sf http://localhost:8173/health || echo 'unreachable')"
wait_http() {
local url=$1
local label=$2
local i=0
while [[ $i -lt 45 ]]; do
if curl -sf "$url" >/dev/null 2>&1; then
echo "${label}: ok"
return 0
fi
sleep 1
i=$((i + 1))
done
echo "${label}: unreachable请确认容器已就绪或执行: curl -v ${url}"
return 1
}
echo "==> 健康检查(后端 8866前端 Nginx 8173最多等待约 45s"
wait_http "http://localhost:8866/health" "backend" || true
wait_http "http://localhost:8173/health" "frontend (nginx)" || true
echo "==> 启动完成"