Kaadan commited on
Commit
1b7e113
·
1 Parent(s): a074596

reduce resources

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. backend/main.py +8 -2
Dockerfile CHANGED
@@ -7,7 +7,7 @@ COPY frontend/ .
7
  # Copy the .env file to ensure environment variables are available during build
8
  COPY frontend/.env* ./
9
  RUN npm run build
10
-
11
  # STAGE 2: Build FastAPI backend + embed frontend
12
  FROM python:3.11-slim
13
  WORKDIR /app
 
7
  # Copy the .env file to ensure environment variables are available during build
8
  COPY frontend/.env* ./
9
  RUN npm run build
10
+ RUN rm -rf node_modules
11
  # STAGE 2: Build FastAPI backend + embed frontend
12
  FROM python:3.11-slim
13
  WORKDIR /app
backend/main.py CHANGED
@@ -69,8 +69,14 @@ async def serve_spa(full_path: str):
69
 
70
  logger.info("Application routes registered")
71
 
72
- # Run server
73
  if __name__ == "__main__":
74
  import uvicorn
75
  logger.info(f"Starting server on {HOST}:{PORT}")
76
- uvicorn.run(app, host=HOST, port=PORT)
 
 
 
 
 
 
 
 
69
 
70
  logger.info("Application routes registered")
71
 
 
72
  if __name__ == "__main__":
73
  import uvicorn
74
  logger.info(f"Starting server on {HOST}:{PORT}")
75
+ uvicorn.run(
76
+ "main:app",
77
+ host=HOST,
78
+ port=PORT,
79
+ log_level="info",
80
+ workers=1, # Limit to 1 worker to reduce memory
81
+ loop="asyncio", # Use default asyncio event loop
82
+ )