Update Dockerfile
Browse files- Dockerfile +13 -15
Dockerfile
CHANGED
|
@@ -3,57 +3,55 @@
|
|
| 3 |
# --------------------------------------------------
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
| 6 |
-
# Prevent Python buffering
|
| 7 |
ENV PYTHONUNBUFFERED=1
|
| 8 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 9 |
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
# --------------------------------------------------
|
| 13 |
-
#
|
| 14 |
# --------------------------------------------------
|
| 15 |
RUN apt-get update && apt-get install -y \
|
| 16 |
git \
|
| 17 |
ffmpeg \
|
|
|
|
| 18 |
libsndfile1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
build-essential \
|
| 20 |
curl \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
# --------------------------------------------------
|
| 24 |
-
#
|
| 25 |
# --------------------------------------------------
|
| 26 |
COPY requirements.txt .
|
| 27 |
|
| 28 |
RUN pip install --upgrade pip setuptools wheel
|
| 29 |
|
| 30 |
-
# Torch
|
| 31 |
RUN pip install --no-cache-dir \
|
| 32 |
torch \
|
| 33 |
torchaudio \
|
| 34 |
--index-url https://download.pytorch.org/whl/cpu
|
| 35 |
|
|
|
|
| 36 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 37 |
|
| 38 |
# --------------------------------------------------
|
| 39 |
-
#
|
| 40 |
# --------------------------------------------------
|
| 41 |
COPY . .
|
| 42 |
|
| 43 |
-
# Create output directory
|
| 44 |
RUN mkdir -p outputs
|
| 45 |
|
| 46 |
-
# --------------------------------------------------
|
| 47 |
-
# Hugging Face Space Port
|
| 48 |
-
# --------------------------------------------------
|
| 49 |
EXPOSE 7860
|
| 50 |
|
| 51 |
-
# --------------------------------------------------
|
| 52 |
-
# Healthcheck (HF stability improvement)
|
| 53 |
-
# --------------------------------------------------
|
| 54 |
HEALTHCHECK CMD curl --fail http://localhost:7860/health || exit 1
|
| 55 |
|
| 56 |
-
# --------------------------------------------------
|
| 57 |
-
# Launch App
|
| 58 |
-
# --------------------------------------------------
|
| 59 |
CMD ["python", "app.py"]
|
|
|
|
| 3 |
# --------------------------------------------------
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
|
|
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 8 |
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
# --------------------------------------------------
|
| 12 |
+
# SYSTEM DEPENDENCIES (FIX FOR PYAV)
|
| 13 |
# --------------------------------------------------
|
| 14 |
RUN apt-get update && apt-get install -y \
|
| 15 |
git \
|
| 16 |
ffmpeg \
|
| 17 |
+
pkg-config \
|
| 18 |
libsndfile1 \
|
| 19 |
+
libavformat-dev \
|
| 20 |
+
libavcodec-dev \
|
| 21 |
+
libavdevice-dev \
|
| 22 |
+
libavutil-dev \
|
| 23 |
+
libavfilter-dev \
|
| 24 |
+
libswscale-dev \
|
| 25 |
+
libswresample-dev \
|
| 26 |
build-essential \
|
| 27 |
curl \
|
| 28 |
&& rm -rf /var/lib/apt/lists/*
|
| 29 |
|
| 30 |
# --------------------------------------------------
|
| 31 |
+
# PYTHON INSTALL
|
| 32 |
# --------------------------------------------------
|
| 33 |
COPY requirements.txt .
|
| 34 |
|
| 35 |
RUN pip install --upgrade pip setuptools wheel
|
| 36 |
|
| 37 |
+
# Install Torch FIRST (stable builds)
|
| 38 |
RUN pip install --no-cache-dir \
|
| 39 |
torch \
|
| 40 |
torchaudio \
|
| 41 |
--index-url https://download.pytorch.org/whl/cpu
|
| 42 |
|
| 43 |
+
# Install remaining deps
|
| 44 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 45 |
|
| 46 |
# --------------------------------------------------
|
| 47 |
+
# COPY APP
|
| 48 |
# --------------------------------------------------
|
| 49 |
COPY . .
|
| 50 |
|
|
|
|
| 51 |
RUN mkdir -p outputs
|
| 52 |
|
|
|
|
|
|
|
|
|
|
| 53 |
EXPOSE 7860
|
| 54 |
|
|
|
|
|
|
|
|
|
|
| 55 |
HEALTHCHECK CMD curl --fail http://localhost:7860/health || exit 1
|
| 56 |
|
|
|
|
|
|
|
|
|
|
| 57 |
CMD ["python", "app.py"]
|