OnyxMunk commited on
Commit
3677501
·
verified ·
1 Parent(s): b445047

Fix Dockerfile: use slim base, add git/ffmpeg, PyTorch extra-index-url, non-root user

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -7
Dockerfile CHANGED
@@ -1,7 +1,27 @@
1
- FROM python:3.10
2
- WORKDIR /app
3
- COPY requirements.txt .
4
- RUN pip install -r requirements.txt
5
- COPY . .
6
- EXPOSE 7860
7
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ git \
8
+ git-lfs \
9
+ ffmpeg \
10
+ libsm6 \
11
+ libxext6 \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy and install Python dependencies
15
+ COPY requirements.txt .
16
+ RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt
17
+
18
+ # Copy app files
19
+ COPY . .
20
+
21
+ # Create non-root user for HF Spaces
22
+ RUN useradd -m -u 1000 user
23
+ USER user
24
+
25
+ EXPOSE 7860
26
+
27
+ CMD ["python", "app.py"]