musev-demo / Dockerfile.spaces
jmanhype
Switch to Docker SDK and rename Dockerfile
deafca6
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV HF_HUB_ENABLE_HF_TRANSFER=0
ENV HUGGINGFACE_HUB_CACHE=/data/huggingface
ENV BUILD_DATE="2024-12-04-01"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
python3-pip \
python3-dev \
ffmpeg \
libsm6 \
libxext6 \
wget \
&& rm -rf /var/lib/apt/lists/*
# Set up a new user
RUN useradd -m -u 1000 user
# Create directories and set permissions
RUN mkdir -p /data/huggingface /data/models && \
chown -R user:user /data
# Switch to user
USER user
# Set environment variables
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
# Set up workspace
WORKDIR $HOME/app
# Install Python packages
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install additional dependencies
RUN pip install --no-cache-dir openmim && \
mim install mmengine && \
mim install "mmcv>=2.0.1" && \
mim install "mmdet>=3.1.0" && \
mim install "mmpose>=1.1.0"
# Copy application code first
COPY --chown=user:user . .
# Clone and set up MuseV
RUN git clone https://github.com/TMElyralab/MuseV.git /tmp/musev && \
cd /tmp/musev && \
git clone https://github.com/huggingface/diffusers.git && \
git clone https://github.com/patrickvonplaten/controlnet_aux.git && \
cd diffusers && pip install -e . && \
cd ../controlnet_aux && pip install -e . && \
cd .. && \
# Copy MuseV contents
cp -r * ../MuseV/ && \
cd .. && \
# Copy gradio scripts
cp MuseV/scripts/gradio/gradio_video2video.py . && \
cp MuseV/scripts/gradio/gradio_text2video.py . && \
chmod +x gradio_*.py && \
# Verify setup
echo "Directory contents:" && ls -la && \
echo "MuseV directory contents:" && ls -la MuseV && \
echo "Scripts directory contents:" && ls -la MuseV/scripts && \
echo "Gradio scripts directory contents:" && ls -la MuseV/scripts/gradio && \
echo "Checking gradio scripts:" && ls -la gradio_*.py && \
echo "Verifying file contents:" && \
cat gradio_video2video.py | head -n 5 && \
echo "---" && \
cat gradio_text2video.py | head -n 5
# Set up Python path
ENV PYTHONPATH="${HOME}/app:${HOME}/app/MuseV:${HOME}/app/MuseV/MMCM:${HOME}/app/MuseV/diffusers/src:${HOME}/app/MuseV/controlnet_aux/src:${HOME}/app/MuseV/scripts/gradio"
EXPOSE 7860
CMD ["python", "-u", "app.py"]