Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +22 -26
Dockerfile
CHANGED
|
@@ -1,20 +1,15 @@
|
|
| 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 |
-
#
|
| 14 |
ARG REPO="https://github.com/TMElyralab/MuseTalk.git"
|
| 15 |
ARG BRANCH="main"
|
| 16 |
-
ARG INSTALL_POSE="false"
|
| 17 |
-
|
| 18 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 19 |
ENV MODEL_DIR=/app/models
|
| 20 |
WORKDIR /app
|
|
@@ -22,8 +17,9 @@ WORKDIR /app
|
|
| 22 |
LABEL org.opencontainers.image.source=${REPO}
|
| 23 |
|
| 24 |
# ----------------- system deps -----------------
|
| 25 |
-
|
| 26 |
-
|
|
|
|
| 27 |
ca-certificates \
|
| 28 |
git \
|
| 29 |
ffmpeg \
|
|
@@ -32,12 +28,13 @@ RUN apt-get update \
|
|
| 32 |
libgl1-mesa-glx \
|
| 33 |
libglib2.0-0 \
|
| 34 |
libjpeg-dev \
|
| 35 |
-
libpng-dev
|
|
|
|
| 36 |
|
| 37 |
# ----------------- clone upstream repo into image -----------------
|
| 38 |
# Shallow clone to keep image smaller (override REPO/BRANCH via --build-arg)
|
| 39 |
-
RUN git clone --depth 1 --branch ${BRANCH} ${REPO} . \
|
| 40 |
-
|
| 41 |
|
| 42 |
# ----------------- overlay local build context (if any) -----------------
|
| 43 |
# If you run `docker build` from the repo root, your local files (app.py, configs/, requirements.txt, etc.)
|
|
@@ -47,24 +44,24 @@ COPY . .
|
|
| 47 |
# ----------------- python tooling & install requirements -----------------
|
| 48 |
RUN pip install --upgrade pip setuptools wheel
|
| 49 |
|
| 50 |
-
# Install requirements
|
| 51 |
RUN if [ -f requirements.txt ]; then \
|
| 52 |
pip install --no-cache-dir -r requirements.txt ; \
|
| 53 |
else \
|
| 54 |
echo "No requirements.txt found; skipping pip install -r requirements.txt"; \
|
| 55 |
fi
|
| 56 |
|
| 57 |
-
# Install
|
| 58 |
RUN pip install --no-cache-dir \
|
| 59 |
livekit==1.0.7 \
|
| 60 |
livekit-api==1.0.2 \
|
| 61 |
omegaconf \
|
| 62 |
-
transformers==4.39.3 \
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
&& pip install --no-cache-dir protobuf==3.20.3 || true
|
| 66 |
|
| 67 |
# ----------------- optional heavy pose/mm packages -----------------
|
|
|
|
| 68 |
RUN if [ "${INSTALL_POSE}" = "true" ]; then \
|
| 69 |
pip install --no-cache-dir cython || true; \
|
| 70 |
pip install --no-cache-dir git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI || true; \
|
|
@@ -77,15 +74,14 @@ RUN if [ "${INSTALL_POSE}" = "true" ]; then \
|
|
| 77 |
fi
|
| 78 |
|
| 79 |
# ----------------- housekeeping -----------------
|
| 80 |
-
RUN find /root/.cache -type f -delete || true \
|
| 81 |
-
|
| 82 |
|
| 83 |
-
#
|
| 84 |
RUN mkdir -p ${MODEL_DIR}
|
| 85 |
|
| 86 |
-
# Expose
|
| 87 |
EXPOSE 7860 8000
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
# Expect that /app/app.py exists in the repo (cloned or from local). If it's in a subfolder, update CMD.
|
| 91 |
CMD ["python3", "app.py"]
|
|
|
|
| 1 |
# syntax=docker/dockerfile:1
|
| 2 |
##############################################################################
|
| 3 |
+
# MuseTalk-ready Dockerfile (fixed line continuations and comment placement)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
##############################################################################
|
| 5 |
|
| 6 |
FROM python:3.9-slim
|
| 7 |
|
| 8 |
+
# Build-time args
|
| 9 |
ARG REPO="https://github.com/TMElyralab/MuseTalk.git"
|
| 10 |
ARG BRANCH="main"
|
| 11 |
+
ARG INSTALL_POSE="false"
|
| 12 |
+
|
| 13 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 14 |
ENV MODEL_DIR=/app/models
|
| 15 |
WORKDIR /app
|
|
|
|
| 17 |
LABEL org.opencontainers.image.source=${REPO}
|
| 18 |
|
| 19 |
# ----------------- system deps -----------------
|
| 20 |
+
# Install necessary system packages
|
| 21 |
+
RUN apt-get update && \
|
| 22 |
+
apt-get install -y --no-install-recommends \
|
| 23 |
ca-certificates \
|
| 24 |
git \
|
| 25 |
ffmpeg \
|
|
|
|
| 28 |
libgl1-mesa-glx \
|
| 29 |
libglib2.0-0 \
|
| 30 |
libjpeg-dev \
|
| 31 |
+
libpng-dev && \
|
| 32 |
+
rm -rf /var/lib/apt/lists/*
|
| 33 |
|
| 34 |
# ----------------- clone upstream repo into image -----------------
|
| 35 |
# Shallow clone to keep image smaller (override REPO/BRANCH via --build-arg)
|
| 36 |
+
RUN git clone --depth 1 --branch ${BRANCH} ${REPO} . && \
|
| 37 |
+
git submodule update --init --recursive || true
|
| 38 |
|
| 39 |
# ----------------- overlay local build context (if any) -----------------
|
| 40 |
# If you run `docker build` from the repo root, your local files (app.py, configs/, requirements.txt, etc.)
|
|
|
|
| 44 |
# ----------------- python tooling & install requirements -----------------
|
| 45 |
RUN pip install --upgrade pip setuptools wheel
|
| 46 |
|
| 47 |
+
# Install requirements from requirements.txt (if present)
|
| 48 |
RUN if [ -f requirements.txt ]; then \
|
| 49 |
pip install --no-cache-dir -r requirements.txt ; \
|
| 50 |
else \
|
| 51 |
echo "No requirements.txt found; skipping pip install -r requirements.txt"; \
|
| 52 |
fi
|
| 53 |
|
| 54 |
+
# Install a few extra packages and pin protobuf to avoid common compatibility issues
|
| 55 |
RUN pip install --no-cache-dir \
|
| 56 |
livekit==1.0.7 \
|
| 57 |
livekit-api==1.0.2 \
|
| 58 |
omegaconf \
|
| 59 |
+
transformers==4.39.3 || true && \
|
| 60 |
+
pip uninstall -y protobuf || true && \
|
| 61 |
+
pip install --no-cache-dir protobuf==3.20.3 || true
|
|
|
|
| 62 |
|
| 63 |
# ----------------- optional heavy pose/mm packages -----------------
|
| 64 |
+
# Set --build-arg INSTALL_POSE=true to enable these (image size will grow)
|
| 65 |
RUN if [ "${INSTALL_POSE}" = "true" ]; then \
|
| 66 |
pip install --no-cache-dir cython || true; \
|
| 67 |
pip install --no-cache-dir git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI || true; \
|
|
|
|
| 74 |
fi
|
| 75 |
|
| 76 |
# ----------------- housekeeping -----------------
|
| 77 |
+
RUN find /root/.cache -type f -delete || true && \
|
| 78 |
+
rm -rf /root/.cache/pip || true
|
| 79 |
|
| 80 |
+
# Ensure model dir exists for mounting at runtime
|
| 81 |
RUN mkdir -p ${MODEL_DIR}
|
| 82 |
|
| 83 |
+
# Expose ports commonly used by the project (adjust if needed)
|
| 84 |
EXPOSE 7860 8000
|
| 85 |
|
| 86 |
+
# Default command: run app.py (expects /app/app.py to exist, local copy overrides cloned if provided)
|
|
|
|
| 87 |
CMD ["python3", "app.py"]
|