JC321 commited on
Commit
0c39a18
·
verified ·
1 Parent(s): 757fdf0

Upload 4 files

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -3
Dockerfile CHANGED
@@ -2,6 +2,11 @@ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
 
 
 
 
 
5
  # Copy requirements and install dependencies
6
  COPY requirements.txt .
7
  RUN pip install --no-cache-dir -r requirements.txt
@@ -14,8 +19,20 @@ COPY mcp_server.py .
14
  # Expose port
15
  EXPOSE 7860
16
 
17
- # Set environment variable
18
  ENV PYTHONUNBUFFERED=1
 
 
 
 
 
19
 
20
- # Run the MCP server
21
- CMD ["uvicorn", "mcp_server:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install curl for health checks
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ curl \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
  # Copy requirements and install dependencies
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
 
19
  # Expose port
20
  EXPOSE 7860
21
 
22
+ # Set environment variables for production
23
  ENV PYTHONUNBUFFERED=1
24
+ ENV PYTHONDONTWRITEBYTECODE=1
25
+
26
+ # Health check for container monitoring
27
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
28
+ CMD curl -f http://localhost:7860/health || exit 1
29
 
30
+ # Run with optimized settings for HF CPU Upgrade
31
+ CMD ["uvicorn", "mcp_server:app", \
32
+ "--host", "0.0.0.0", \
33
+ "--port", "7860", \
34
+ "--workers", "2", \
35
+ "--timeout-keep-alive", "75", \
36
+ "--limit-concurrency", "200", \
37
+ "--backlog", "2048", \
38
+ "--log-level", "info"]