diff --git a/sanguo_api/main.py b/sanguo_api/main.py index 75a5129..047294f 100644 --- a/sanguo_api/main.py +++ b/sanguo_api/main.py @@ -61,6 +61,12 @@ def build_app(config_path: str = "config/backtest.yaml", static_dir: str | None max_workers=max_workers, ) + # Liveness probe for Docker HEALTHCHECK (curl -f /health). Registered + # unconditionally so it works with or without the SPA static mount. + @app.get("/health", include_in_schema=False) + async def _health() -> dict[str, str]: + return {"status": "ok"} + # SPA static mount with history fallback. Register the root route BEFORE # mounting StaticFiles at "/" so the explicit handler wins for "/". if static_dir and os.path.isdir(static_dir):