Update Dockerfile
Browse files- Dockerfile +16 -13
Dockerfile
CHANGED
|
@@ -1,28 +1,31 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Prevents python writing .pyc files and buffers
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
# Install
|
| 9 |
-
RUN apt-get update && \
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
build-essential \
|
| 13 |
-
git \
|
| 14 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
COPY requirements.txt /tmp/requirements.txt
|
| 18 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 19 |
|
| 20 |
-
# Copy app
|
| 21 |
COPY . /app
|
| 22 |
WORKDIR /app
|
| 23 |
|
| 24 |
-
# Expose
|
| 25 |
ENV PORT=7860
|
| 26 |
|
| 27 |
-
# Launch
|
| 28 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Use a slim Python base
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
|
|
|
| 4 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
+
# increase pip timeout to help larger downloads (optional)
|
| 7 |
+
ENV PIP_DEFAULT_TIMEOUT=1200
|
| 8 |
|
| 9 |
+
# Install system deps (ffmpeg + build deps)
|
| 10 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
+
ffmpeg git build-essential curl libsm6 libxext6 libgl1 \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Install CPU-only PyTorch wheel first (smaller & reliable)
|
| 15 |
+
# This installs a stable CPU build of torch & torchvision from official index
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade pip \
|
| 17 |
+
&& pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
|
| 18 |
+
|
| 19 |
+
# Copy requirements and install everything else (do NOT include torch here)
|
| 20 |
COPY requirements.txt /tmp/requirements.txt
|
| 21 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 22 |
|
| 23 |
+
# Copy app and set workdir
|
| 24 |
COPY . /app
|
| 25 |
WORKDIR /app
|
| 26 |
|
| 27 |
+
# Expose HF default port
|
| 28 |
ENV PORT=7860
|
| 29 |
|
| 30 |
+
# Launch app
|
| 31 |
CMD ["python", "app.py"]
|