Deadman922 commited on
Commit
caebe17
·
verified ·
1 Parent(s): 1eb3b89

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Environment configuration
6
+ ENV ENABLE_WEB_INTERFACE=true
7
+ ENV PYTHONPATH=/app
8
+
9
+ # Create non-root user for security
10
+ RUN adduser --disabled-password --gecos '' nonroot
11
+
12
+ # Install uv
13
+ RUN pip install --no-cache-dir uv
14
+
15
+ # Copy dependencies first (cache layer)
16
+ COPY requirements.txt .
17
+ RUN uv pip install --system --no-cache -r requirements.txt
18
+
19
+ # Copy application code
20
+ COPY . .
21
+
22
+ # Set ownership and switch to non-root user
23
+ RUN chown -R nonroot:nonroot /app
24
+ USER nonroot
25
+
26
+ # Expose the port
27
+ EXPOSE 7860
28
+
29
+ # Health check
30
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
31
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" || exit 1
32
+
33
+ # Start the server
34
+ CMD ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "7860"]