File size: 2,555 Bytes
8a96b9c
 
86a4a6f
8a96b9c
 
5f9062d
 
b9efe31
8a96b9c
 
b9efe31
 
8a96b9c
 
5f9062d
 
8a96b9c
 
86a4a6f
b9efe31
 
8a96b9c
 
 
 
 
 
 
 
b9efe31
 
5f9062d
86a4a6f
 
 
 
5f9062d
86a4a6f
5f9062d
 
86a4a6f
 
 
8a96b9c
86a4a6f
 
 
5e7263f
8a96b9c
86a4a6f
8a96b9c
 
86a4a6f
5e7263f
 
8a96b9c
 
 
86a4a6f
 
8a96b9c
86a4a6f
 
 
 
 
 
 
 
 
8a96b9c
 
 
 
86a4a6f
5e7263f
8a96b9c
86a4a6f
8a96b9c
5f9062d
86a4a6f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# syntax=docker/dockerfile:1
##############################################################################
# MuseTalk-ready Dockerfile (cleaned, consistent, safer installs)
##############################################################################

FROM python:3.9-slim

# Build-time args
ARG REPO="https://github.com/TMElyralab/MuseTalk.git"
ARG BRANCH="main"
ARG INSTALL_POSE="false"

ENV DEBIAN_FRONTEND=noninteractive
ENV MODEL_DIR=/app/models
WORKDIR /app

LABEL org.opencontainers.image.source=${REPO}

# Install system dependencies in a single layer
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      ca-certificates \
      git \
      ffmpeg \
      build-essential \
      python3-dev \
      libgl1-mesa-glx \
      libglib2.0-0 \
      libjpeg-dev \
      libpng-dev && \
    rm -rf /var/lib/apt/lists/*

# Shallow clone the repository
RUN set -eux; \
    git clone --depth 1 --branch "${BRANCH}" "${REPO}" . && \
    git submodule update --init --recursive

# Overlay local build context (if any)
COPY . .

# Upgrade pip and install requirements
RUN set -eux; \
    pip install --no-cache-dir --upgrade pip setuptools wheel

# Install requirements.txt if present, fail if missing (adjust if optional)
RUN set -eux; \
    if [ -f requirements.txt ]; then \
      pip install --no-cache-dir -r requirements.txt; \
    else \
      echo "Warning: requirements.txt not found; ensure dependencies are installed manually"; \
    fi

# Install additional Python packages with pinned versions
RUN set -eux; \
    pip install --no-cache-dir \
      livekit==1.0.7 \
      livekit-api==1.0.2 \
      omegaconf \
      transformers==4.39.3 \
      protobuf==3.20.3 --force-reinstall

# Install optional pose/mm packages if enabled
RUN set -eux; \
    if [ "${INSTALL_POSE}" = "true" ]; then \
      pip install --no-cache-dir cython; \
      pip install --no-cache-dir git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI; \
      pip install --no-cache-dir openmim; \
      pip install --no-cache-dir mmengine==0.10.7 mmcv==2.0.0rc4; \
      python -m mim install mmpose; \
      python -m mim install mmdet; \
    else \
      echo "Skipping pose/mm installation (set --build-arg INSTALL_POSE=true to enable)"; \
    fi

# Ensure model directory exists
RUN mkdir -p "${MODEL_DIR}"

# Expose ports (confirm these match app.py requirements)
EXPOSE 7860 8000

# Verify app.py exists before running
CMD ["sh", "-c", "if [ -f app.py ]; then python3 app.py; else echo 'Error: app.py not found'; exit 1; fi"]