Update Dockerfile
Browse files- Dockerfile +15 -13
Dockerfile
CHANGED
|
@@ -1,34 +1,36 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
|
| 3 |
# System deps
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
ffmpeg git \
|
| 6 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
# HF Spaces requires uid 1000
|
| 9 |
-
RUN useradd -m -u 1000 user
|
| 10 |
USER user
|
| 11 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
-
ENV HF_HOME="/home/user/.cache/huggingface"
|
| 13 |
|
| 14 |
-
WORKDIR /home/user/app
|
| 15 |
|
| 16 |
-
# Install Python deps —
|
| 17 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 18 |
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu \
|
| 19 |
torch==2.6.0+cpu \
|
| 20 |
transformers>=4.49.0 \
|
| 21 |
accelerate>=1.3.0 \
|
| 22 |
flask==3.1.1 \
|
|
|
|
| 23 |
huggingface_hub>=0.27.0 \
|
| 24 |
-
edge-tts
|
| 25 |
|
| 26 |
-
# Copy project files
|
| 27 |
-
COPY --chown=user:user . .
|
| 28 |
|
| 29 |
-
# Make sure img dir exists
|
| 30 |
-
RUN mkdir -p /home/user/app/img
|
| 31 |
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
-
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim [cite: 1]
|
| 2 |
|
| 3 |
# System deps
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
ffmpeg git \
|
| 6 |
+
&& rm -rf /var/lib/apt/lists/* [cite: 1]
|
| 7 |
|
| 8 |
# HF Spaces requires uid 1000
|
| 9 |
+
RUN useradd -m -u 1000 user [cite: 1]
|
| 10 |
USER user
|
| 11 |
+
ENV PATH="/home/user/.local/bin:$PATH" [cite: 1]
|
| 12 |
+
ENV HF_HOME="/home/user/.cache/huggingface" [cite: 1]
|
| 13 |
|
| 14 |
+
WORKDIR /home/user/app [cite: 1]
|
| 15 |
|
| 16 |
+
# Install Python deps — Including gunicorn for stability
|
| 17 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 18 |
pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu \
|
| 19 |
torch==2.6.0+cpu \
|
| 20 |
transformers>=4.49.0 \
|
| 21 |
accelerate>=1.3.0 \
|
| 22 |
flask==3.1.1 \
|
| 23 |
+
gunicorn \
|
| 24 |
huggingface_hub>=0.27.0 \
|
| 25 |
+
edge-tts [cite: 1]
|
| 26 |
|
| 27 |
+
# Copy project files
|
| 28 |
+
COPY --chown=user:user . . [cite: 2]
|
| 29 |
|
| 30 |
+
# Make sure img dir exists
|
| 31 |
+
RUN mkdir -p /home/user/app/img [cite: 1]
|
| 32 |
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
+
# Use gunicorn to avoid health-check timeouts
|
| 36 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--timeout", "120"]
|