Update Dockerfile
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
# System
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
ffmpeg git \
|
| 6 |
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
-
#
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
USER user
|
| 11 |
ENV PATH="/home/user/.local/bin:$PATH"
|
|
@@ -13,22 +13,22 @@ ENV HF_HOME="/home/user/.cache/huggingface"
|
|
| 13 |
|
| 14 |
WORKDIR /home/user/app
|
| 15 |
|
| 16 |
-
# Install
|
| 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
|
| 26 |
|
| 27 |
-
# Copy files
|
| 28 |
COPY --chown=user:user . .
|
|
|
|
|
|
|
| 29 |
RUN mkdir -p /home/user/app/img
|
| 30 |
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
|
| 34 |
-
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--timeout", "120"]
|
|
|
|
| 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"
|
|
|
|
| 13 |
|
| 14 |
WORKDIR /home/user/app
|
| 15 |
|
| 16 |
+
# Install Python deps — CPU-only torch to save memory
|
| 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 (includes app.py and img/ folder)
|
| 27 |
COPY --chown=user:user . .
|
| 28 |
+
|
| 29 |
+
# Make sure img dir exists even if empty (default.png must be inside)
|
| 30 |
RUN mkdir -p /home/user/app/img
|
| 31 |
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
+
CMD ["python", "app.py"]
|
|
|