Rox-Turbo commited on
Commit
19d468d
·
verified ·
1 Parent(s): 68ea108

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -22
Dockerfile CHANGED
@@ -1,22 +1,27 @@
1
- FROM python:3.11-slim
2
-
3
- WORKDIR /app
4
-
5
- ENV PYTHONDONTWRITEBYTECODE=1 \
6
- PYTHONUNBUFFERED=1
7
-
8
- RUN groupadd --system app && useradd --system --gid app app
9
-
10
- COPY requirements.txt .
11
- RUN pip install --no-cache-dir -r requirements.txt
12
-
13
- COPY . .
14
-
15
- RUN chown -R app:app /app
16
- USER app
17
-
18
- # NVIDIA_API_KEY must be provided at runtime (docker run -e ... or env_file)
19
- EXPOSE 8000
20
-
21
- CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"]
22
-
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1
7
+
8
+ # Install dependencies first (better caching)
9
+ COPY requirements.txt .
10
+ RUN pip install --no-cache-dir -r requirements.txt
11
+
12
+ # Copy application code
13
+ COPY . .
14
+
15
+ # Hugging Face Spaces runs as user 1000
16
+ RUN useradd -m -u 1000 user
17
+ USER user
18
+
19
+ # Set PATH for user
20
+ ENV PATH="/home/user/.local/bin:$PATH"
21
+
22
+ # Expose port 7860 (Hugging Face Spaces default)
23
+ EXPOSE 7860
24
+
25
+ # Start server on port 7860 for Hugging Face Spaces
26
+ CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
27
+