Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -20
Dockerfile
CHANGED
|
@@ -1,41 +1,39 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
| 4 |
ENV PORT=7860
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
-
# --- System dependencies (
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
build-essential \
|
|
|
|
| 11 |
git \
|
| 12 |
-
ca-certificates \
|
| 13 |
ffmpeg \
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
|
| 24 |
-
# ---
|
| 25 |
-
RUN
|
| 26 |
|
| 27 |
-
# ---
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
RUN python -m pip install --upgrade pip setuptools wheel huggingface_hub
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 36 |
|
| 37 |
-
# --- HF Spaces port ---
|
| 38 |
EXPOSE 7860
|
| 39 |
|
| 40 |
-
# --- Run Flask-SocketIO app ---
|
| 41 |
CMD ["python", "-u", "app.py"]
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
+
ENV PYTHONUNBUFFERED=1
|
| 5 |
ENV PORT=7860
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# --- System dependencies (Optimized for WebRTC & CV) ---
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
build-essential \
|
| 12 |
+
pkg-config \
|
| 13 |
git \
|
|
|
|
| 14 |
ffmpeg \
|
| 15 |
+
libavdevice-dev libavfilter-dev libavformat-dev libavcodec-dev \
|
| 16 |
+
libswresample-dev libswscale-dev libavutil-dev \
|
| 17 |
+
libgl1 libglib2.0-0 \
|
| 18 |
+
# Speed trick: TCMalloc for better memory management in PyTorch
|
| 19 |
+
libgoogle-perftools-dev \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
+
# Set TCMalloc as the memory allocator
|
| 23 |
+
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4"
|
| 24 |
|
| 25 |
+
# --- Python Setup ---
|
| 26 |
+
RUN python -m pip install --upgrade pip setuptools wheel
|
| 27 |
|
| 28 |
+
# --- Dependencies ---
|
| 29 |
+
COPY requirements.txt .
|
| 30 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 31 |
|
| 32 |
+
COPY . .
|
|
|
|
| 33 |
|
| 34 |
+
# Setup permissions
|
| 35 |
+
RUN mkdir -p static/uploads static/results && chmod -R 777 static/uploads static/results
|
|
|
|
| 36 |
|
|
|
|
| 37 |
EXPOSE 7860
|
| 38 |
|
|
|
|
| 39 |
CMD ["python", "-u", "app.py"]
|