gauthamnairy commited on
Commit
5c6951c
·
verified ·
1 Parent(s): 5d7ab3d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -2
Dockerfile CHANGED
@@ -17,6 +17,7 @@ from fastapi.responses import HTMLResponse, FileResponse, Response\n\
17
  from fastapi.staticfiles import StaticFiles\n\
18
  from fastapi.middleware.cors import CORSMiddleware\n\
19
  import importlib.util\n\
 
20
  \n\
21
  # Configure logging\n\
22
  logging.basicConfig(level=logging.INFO)\n\
@@ -28,6 +29,11 @@ backend_module = importlib.util.module_from_spec(spec)\n\
28
  spec.loader.exec_module(backend_module)\n\
29
  backend_app = backend_module.app\n\
30
  \n\
 
 
 
 
 
31
  # Create the main app\n\
32
  app = FastAPI()\n\
33
  \n\
@@ -40,8 +46,30 @@ app.add_middleware(\n\
40
  allow_headers=["*"],\n\
41
  )\n\
42
  \n\
43
- # Mount the backend API\n\
44
- app.mount("/api", backend_app)\n\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  \n\
46
  # List all files in the frontend directory for debugging\n\
47
  logger.info("Listing frontend directory contents:")\n\
 
17
  from fastapi.staticfiles import StaticFiles\n\
18
  from fastapi.middleware.cors import CORSMiddleware\n\
19
  import importlib.util\n\
20
+ import inspect\n\
21
  \n\
22
  # Configure logging\n\
23
  logging.basicConfig(level=logging.INFO)\n\
 
29
  spec.loader.exec_module(backend_module)\n\
30
  backend_app = backend_module.app\n\
31
  \n\
32
+ # Print all routes for debugging\n\
33
+ logger.info("Backend routes:")\n\
34
+ for route in backend_app.routes:\n\
35
+ logger.info(f" {route.path} - {route.methods}")\n\
36
+ \n\
37
  # Create the main app\n\
38
  app = FastAPI()\n\
39
  \n\
 
46
  allow_headers=["*"],\n\
47
  )\n\
48
  \n\
49
+ # Fix API path prefix issues by adding direct proxy routes\n\
50
+ logger.info("Setting up API proxy routes")\n\
51
+ \n\
52
+ @app.post("/api/elevation")\n\
53
+ async def elevation_proxy(request: Request):\n\
54
+ logger.info("Received elevation request")\n\
55
+ # Import the handler function directly\n\
56
+ from backend.main import get_elevation, CoordinateRequest\n\
57
+ # Parse the JSON payload\n\
58
+ payload = await request.json()\n\
59
+ # Create the request model\n\
60
+ coord_request = CoordinateRequest(**payload)\n\
61
+ # Call the handler function\n\
62
+ result = await get_elevation(coord_request)\n\
63
+ return result\n\
64
+ \n\
65
+ @app.get("/api/crs-list")\n\
66
+ async def crs_list_proxy():\n\
67
+ logger.info("Received CRS list request")\n\
68
+ # Import the handler function directly\n\
69
+ from backend.main import get_crs_list\n\
70
+ # Call the handler function\n\
71
+ result = await get_crs_list()\n\
72
+ return result\n\
73
  \n\
74
  # List all files in the frontend directory for debugging\n\
75
  logger.info("Listing frontend directory contents:")\n\