fffiloni commited on
Commit
6b113cf
·
verified ·
1 Parent(s): 43b3059

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -36
Dockerfile CHANGED
@@ -7,7 +7,7 @@ ENV MKL_THREADING_LAYER=GNU
7
  RUN apt-get update && apt-get install -y \
8
  git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
9
  build-essential cmake g++ python3-dev software-properties-common \
10
- wget gnupg2 libopenblas-dev && \
11
  rm -rf /var/lib/apt/lists/*
12
 
13
  # Add NVIDIA package repositories
@@ -18,55 +18,58 @@ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86
18
  # Install CUDA Toolkit and cuDNN
19
  RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev
20
 
21
- # Create a user
22
- RUN useradd -m -u 1000 user
23
- USER user
24
-
25
- # Set CUDA paths
26
- ENV HOME=/home/user \
27
- PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \
28
- PYTHONPATH=$HOME/app \
29
- PYTHONUNBUFFERED=1 \
30
- GRADIO_ALLOW_FLAGGING=never \
31
- GRADIO_NUM_PORTS=1 \
32
- GRADIO_SERVER_NAME=0.0.0.0 \
33
- GRADIO_THEME=huggingface \
34
- GRADIO_SHARE=False \
35
- SYSTEM=spaces \
36
  CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
37
  CUDA_HOME=/usr/local/cuda \
38
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
39
- TORCH_CUDA_ARCH_LIST="8.6"
 
40
 
41
- # Set CUDA & cuDNN paths
42
- ENV CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
 
43
 
44
- # Set working directory
45
- WORKDIR $HOME/app
46
 
47
  # Clone the repository
48
- RUN git clone -b dev https://github.com/fffiloni/dreamtalk $HOME/app
49
 
50
  # Download model checkpoints
51
- RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O $HOME/app/checkpoints/denoising_network.pth
52
- RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O $HOME/app/checkpoints/renderer.pt
53
 
54
- # Upgrade pip & install dependencies
55
- RUN pip install --upgrade pip setuptools wheel
56
- RUN pip install --no-cache-dir urllib3 transformers yacs scipy scikit-image scikit-learn PyYAML Pillow "numpy<2" opencv-python imageio ffmpeg-python av "moviepy<2" gradio
 
57
 
58
- # Install CMake first
59
- RUN pip install cmake
60
 
61
- # Install dlib with CUDA support (force source compilation)
62
- RUN pip install --no-cache-dir dlib -vvv --no-binary dlib
 
63
 
64
- # Copy application file
65
- COPY app.py .
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
- # Set CUDA environment variables
68
- ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
69
- ENV CUDA_VISIBLE_DEVICES=0
70
 
71
  # Run the application
72
  CMD ["python", "app.py"]
 
7
  RUN apt-get update && apt-get install -y \
8
  git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
9
  build-essential cmake g++ python3-dev software-properties-common \
10
+ wget gnupg2 libopenblas-dev libx11-dev && \
11
  rm -rf /var/lib/apt/lists/*
12
 
13
  # Add NVIDIA package repositories
 
18
  # Install CUDA Toolkit and cuDNN
19
  RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev
20
 
21
+ # Set CUDA paths for build environment
22
+ ENV PATH=/usr/local/cuda/bin:$PATH \
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
24
  CUDA_HOME=/usr/local/cuda \
25
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
26
+ CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/" \
27
+ TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6"
28
 
29
+ # Upgrade pip & install dependencies
30
+ RUN pip install --upgrade pip setuptools wheel
31
+ RUN pip install --no-cache-dir urllib3 transformers yacs scipy scikit-image scikit-learn PyYAML Pillow "numpy<2" opencv-python imageio ffmpeg-python av "moviepy<2" gradio cmake
32
 
33
+ # Create app directory structure first
34
+ RUN mkdir -p /app/checkpoints
35
 
36
  # Clone the repository
37
+ RUN git clone -b dev https://github.com/fffiloni/dreamtalk /app
38
 
39
  # Download model checkpoints
40
+ RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O /app/checkpoints/denoising_network.pth && \
41
+ wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O /app/checkpoints/renderer.pt
42
 
43
+ # Explicitly set environment variables for dlib compilation
44
+ ENV DLIB_USE_CUDA=1 \
45
+ DLIB_JPEG_SUPPORT=1 \
46
+ DLIB_PNG_SUPPORT=1
47
 
48
+ # Install dlib with CUDA support
49
+ RUN pip install --no-cache-dir dlib==19.24.0
50
 
51
+ # Create a user and set ownership
52
+ RUN useradd -m -u 1000 user && \
53
+ chown -R user:user /app
54
 
55
+ # Set environment variables for runtime
56
+ ENV PYTHONPATH=/app \
57
+ PYTHONUNBUFFERED=1 \
58
+ GRADIO_ALLOW_FLAGGING=never \
59
+ GRADIO_NUM_PORTS=1 \
60
+ GRADIO_SERVER_NAME=0.0.0.0 \
61
+ GRADIO_THEME=huggingface \
62
+ GRADIO_SHARE=False \
63
+ SYSTEM=spaces \
64
+ CUDA_DEVICE_ORDER=PCI_BUS_ID \
65
+ CUDA_VISIBLE_DEVICES=0
66
+
67
+ # Switch to user
68
+ USER user
69
+ WORKDIR /app
70
 
71
+ # Copy application file (assuming it's in the build context)
72
+ COPY --chown=user:user app.py /app/
 
73
 
74
  # Run the application
75
  CMD ["python", "app.py"]