Enhance Docker and Compose configurations; add health check endpoint and caching improvements

- Updated Dockerfile to include FINN_CACHE_PATH and create data directory.
- Modified docker-compose.prod.yml to expose port 8010 and adjust resource limits.
- Updated docker-compose.yml to include FINN_CACHE_PATH and ensure proper port mapping.
- Added health check endpoint in http_server.py for container orchestration.
- Improved caching logic in analysis.py and service.py for similar units.
- Refined scoring.py with updated scoring model and constants for better accuracy.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Ole
2026-05-26 12:10:00 +00:00
parent d3f4bfa838
commit 46fd22c277
7 changed files with 315 additions and 233 deletions
+23
View File
@@ -1,4 +1,8 @@
import json
import uvicorn
from starlette.responses import JSONResponse
from starlette.requests import Request
from starlette.middleware.cors import CORSMiddleware
from mcp.server.transport_security import TransportSecuritySettings
from finn_eiendom.mcp_server import mcp
@@ -6,5 +10,24 @@ mcp.transport_security = TransportSecuritySettings(enable_dns_rebinding_protecti
app = mcp.sse_app()
# Add CORS middleware to allow browser-based clients (e.g., MCP Inspector)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Health check endpoint for container orchestration
async def health(request: Request) -> JSONResponse:
"""Return a simple health status for container probes."""
return JSONResponse({"status": "ok"})
app.add_route("/health", health, methods=["GET"])
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8010, forwarded_allow_ips="*")