Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +82 -42
Dockerfile
CHANGED
|
@@ -1,52 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
| 3 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
# Install LiveKit SDKs
|
| 27 |
-
RUN pip install --no-cache-dir \
|
| 28 |
-
livekit==1.0.7 \
|
| 29 |
-
livekit-api==1.0.2 \
|
| 30 |
-
omegaconf \
|
| 31 |
-
transformers==4.39.3 \
|
| 32 |
-
&& pip uninstall -y protobuf && pip install --no-cache-dir protobuf==3.20.3
|
| 33 |
-
|
| 34 |
-
# Install pose dependencies (with caching minimized)
|
| 35 |
-
RUN pip install --no-cache-dir cython && \
|
| 36 |
-
pip install --no-cache-dir git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI
|
| 37 |
-
|
| 38 |
-
RUN pip install --no-cache-dir mmengine==0.10.7 mmcv==2.0.0rc4 && \
|
| 39 |
-
pip install --no-cache-dir openmim && \
|
| 40 |
-
mim install mmpose && \
|
| 41 |
-
mim install mmdet
|
| 42 |
-
|
| 43 |
-
# Copy rest of the code
|
| 44 |
COPY . .
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
RUN
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
#
|
|
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1
|
| 2 |
+
##############################################################################
|
| 3 |
+
# MuseTalk-ready Dockerfile
|
| 4 |
+
# - clones upstream repo (default)
|
| 5 |
+
# - overlays local build context if present (so local app.py / configs / requirements.txt override cloned ones)
|
| 6 |
+
# - installs requirements (from local if provided, otherwise from cloned repo)
|
| 7 |
+
# - optionally installs heavy pose/mm deps via build-arg INSTALL_POSE=true
|
| 8 |
+
# - does NOT download large model weights during build (mount at runtime)
|
| 9 |
+
##############################################################################
|
| 10 |
+
|
| 11 |
FROM python:3.9-slim
|
| 12 |
|
| 13 |
+
# Repo to clone and branch (override at build time if needed)
|
| 14 |
+
ARG REPO="https://github.com/TMElyralab/MuseTalk.git"
|
| 15 |
+
ARG BRANCH="main"
|
| 16 |
+
ARG INSTALL_POSE="false" # set to "true" to install mmpose/mm packages (image grows)
|
| 17 |
+
ARG PYTHONUNBUFFERED="1"
|
| 18 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 19 |
+
ENV MODEL_DIR=/app/models
|
| 20 |
WORKDIR /app
|
| 21 |
|
| 22 |
+
LABEL org.opencontainers.image.source=${REPO}
|
| 23 |
+
|
| 24 |
+
# ----------------- system deps -----------------
|
| 25 |
+
RUN apt-get update \
|
| 26 |
+
&& apt-get install -y --no-install-recommends \
|
| 27 |
+
ca-certificates \
|
| 28 |
+
git \
|
| 29 |
+
ffmpeg \
|
| 30 |
+
build-essential \
|
| 31 |
+
python3-dev \
|
| 32 |
+
libgl1-mesa-glx \
|
| 33 |
+
libglib2.0-0 \
|
| 34 |
+
libjpeg-dev \
|
| 35 |
+
libpng-dev \
|
| 36 |
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
|
| 38 |
+
# ----------------- clone upstream repo into image -----------------
|
| 39 |
+
# Shallow clone to keep image smaller (override REPO/BRANCH via --build-arg)
|
| 40 |
+
RUN git clone --depth 1 --branch ${BRANCH} ${REPO} . \
|
| 41 |
+
&& git submodule update --init --recursive || true
|
| 42 |
|
| 43 |
+
# ----------------- overlay local build context (if any) -----------------
|
| 44 |
+
# If you run `docker build` from the repo root, your local files (app.py, configs/, requirements.txt, etc.)
|
| 45 |
+
# will overwrite the cloned files. If you build from an empty folder, this COPY is effectively a no-op.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
COPY . .
|
| 47 |
|
| 48 |
+
# ----------------- python tooling & install requirements -----------------
|
| 49 |
+
RUN pip install --upgrade pip setuptools wheel
|
| 50 |
+
|
| 51 |
+
# Install requirements if the file exists (it will come from local build context if present, otherwise from cloned repo)
|
| 52 |
+
RUN if [ -f requirements.txt ]; then \
|
| 53 |
+
pip install --no-cache-dir -r requirements.txt ; \
|
| 54 |
+
else \
|
| 55 |
+
echo "No requirements.txt found; skipping pip install -r requirements.txt"; \
|
| 56 |
+
fi
|
| 57 |
+
|
| 58 |
+
# Install common extra packages used by the project and pin protobuf to avoid compatibility issues
|
| 59 |
+
RUN pip install --no-cache-dir \
|
| 60 |
+
livekit==1.0.7 \
|
| 61 |
+
livekit-api==1.0.2 \
|
| 62 |
+
omegaconf \
|
| 63 |
+
transformers==4.39.3 \
|
| 64 |
+
|| true \
|
| 65 |
+
&& pip uninstall -y protobuf || true \
|
| 66 |
+
&& pip install --no-cache-dir protobuf==3.20.3 || true
|
| 67 |
+
|
| 68 |
+
# ----------------- optional heavy pose/mm packages -----------------
|
| 69 |
+
RUN if [ "${INSTALL_POSE}" = "true" ]; then \
|
| 70 |
+
pip install --no-cache-dir cython || true; \
|
| 71 |
+
pip install --no-cache-dir git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI || true; \
|
| 72 |
+
pip install --no-cache-dir openmim || true; \
|
| 73 |
+
pip install --no-cache-dir mmengine==0.10.7 mmcv==2.0.0rc4 || true; \
|
| 74 |
+
mim install mmpose || true; \
|
| 75 |
+
mim install mmdet || true; \
|
| 76 |
+
else \
|
| 77 |
+
echo "Skipping pose/mm installation (set --build-arg INSTALL_POSE=true to enable)"; \
|
| 78 |
+
fi
|
| 79 |
+
|
| 80 |
+
# ----------------- housekeeping -----------------
|
| 81 |
+
RUN find /root/.cache -type f -delete || true \
|
| 82 |
+
&& rm -rf /root/.cache/pip || true
|
| 83 |
+
|
| 84 |
+
# Make sure model dir exists (mount your weights here at runtime)
|
| 85 |
+
RUN mkdir -p ${MODEL_DIR}
|
| 86 |
+
|
| 87 |
+
# Expose typical ports (adjust if your app uses different ports)
|
| 88 |
+
EXPOSE 7860 8000
|
| 89 |
|
| 90 |
+
# ----------------- runtime command -----------------
|
| 91 |
+
# Expect that /app/app.py exists in the repo (cloned or from local). If it's in a subfolder, update CMD.
|
| 92 |
+
CMD ["python3", "app.py"]
|