jmanhype commited on
Commit
8fbdd85
Β·
1 Parent(s): f4beea0

refactor: update Dockerfile to install dependencies incrementally with better error handling

Browse files
Files changed (1) hide show
  1. scripts/gradio/Dockerfile +30 -29
scripts/gradio/Dockerfile CHANGED
@@ -1,50 +1,51 @@
1
- FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
2
 
3
- # Install basic dependencies
4
  RUN apt-get update && apt-get install -y \
5
  wget \
6
  git \
7
- python3 \
8
- python3-pip \
9
  ffmpeg \
10
  libsm6 \
11
  libxext6 \
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Create non-root user
15
- RUN useradd -m -s /bin/bash huggingface
16
- WORKDIR /home/huggingface
 
 
17
 
18
- # Set up git config
19
  RUN git config --global user.email "[email protected]" && \
20
  git config --global user.name "jmanhype"
21
 
22
- # Copy application code
23
- COPY . /home/huggingface/app/
24
- WORKDIR /home/huggingface/app
 
 
 
 
 
25
 
26
- # Install Python dependencies
27
- RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
28
- RUN pip3 install --no-cache-dir -r requirements.txt
29
- RUN pip3 install --no-cache-dir gradio spaces
30
 
31
- # Install additional dependencies for controlnet_aux
32
- RUN pip3 install --no-cache-dir openmim && \
33
- mim install mmcv>=2.0.1 && \
34
- mim install mmdet>=3.1.0 && \
35
- mim install mmpose>=1.1.0
36
 
37
- # Set Python path
38
- ENV PYTHONPATH=/home/huggingface/app:/home/huggingface/app/MMCM:/home/huggingface/app/diffusers/src:/home/huggingface/app/controlnet_aux/src
 
39
 
40
- # Set ownership
41
- RUN chown -R huggingface:huggingface /home/huggingface
 
42
 
43
- # Switch to non-root user
44
- USER huggingface
45
 
46
- # Expose port
47
  EXPOSE 7860
48
 
49
- # Run the app
50
- CMD ["python3", "scripts/gradio/app_gradio_space.py"]
 
1
+ FROM continuumio/miniconda3:latest
2
 
 
3
  RUN apt-get update && apt-get install -y \
4
  wget \
5
  git \
 
 
6
  ffmpeg \
7
  libsm6 \
8
  libxext6 \
9
+ ninja-build \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ RUN useradd -m -u 1000 user
13
+ RUN mkdir -p /home/user/app/scripts/gradio && \
14
+ chown -R user:user /home/user/app
15
+
16
+ WORKDIR /home/user/app
17
 
 
18
  RUN git config --global user.email "[email protected]" && \
19
  git config --global user.name "jmanhype"
20
 
21
+ RUN rm -rf * .* || true && \
22
+ git clone https://github.com/TMElyralab/MuseV.git . && \
23
+ ls -la scripts/gradio/app_gradio_space.py && \
24
+ echo "=== Repository contents ===" && \
25
+ ls -la scripts/gradio/
26
+
27
+ RUN conda create -n musev python=3.10 -y && \
28
+ echo "conda activate musev" >> ~/.bashrc
29
 
30
+ RUN conda run -n musev pip install --no-cache-dir setuptools==65.5.1
 
 
 
31
 
32
+ # Install requirements one by one with error handling
33
+ RUN conda run -n musev pip install --no-cache-dir git+https://github.com/TMElyralab/diffusers.git@tme || exit 1
34
+ RUN conda run -n musev pip install --no-cache-dir git+https://github.com/tencent-ailab/IP-Adapter.git@main || exit 1
35
+ RUN conda run -n musev pip install --no-cache-dir git+https://github.com/openai/CLIP.git@main || exit 1
36
+ RUN conda run -n musev pip install --no-cache-dir git+https://github.com/TMElyralab/controlnet_aux.git@tme || exit 1
37
 
38
+ # Install MMCM with additional dependencies that might be needed
39
+ RUN conda run -n musev pip install --no-cache-dir numpy torch torchvision torchaudio
40
+ RUN conda run -n musev pip install --no-cache-dir git+https://github.com/TMElyralab/MMCM.git@setup || exit 1
41
 
42
+ # Install remaining requirements from requirements.txt
43
+ COPY scripts/gradio/requirements.txt .
44
+ RUN conda run -n musev pip install --no-cache-dir -r requirements.txt || exit 1
45
 
46
+ COPY scripts/gradio/entrypoint.sh /entrypoint.sh
47
+ RUN chmod +x /entrypoint.sh
48
 
 
49
  EXPOSE 7860
50
 
51
+ CMD ["/entrypoint.sh"]