fffiloni commited on
Commit
dabec21
·
verified ·
1 Parent(s): 33ebbe5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -27
Dockerfile CHANGED
@@ -18,42 +18,44 @@ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86
18
  # Install CUDA Toolkit and cuDNN (with version matching the base image)
19
  RUN apt-get install -y cuda-toolkit-12-1 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;8.9;9.0"
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 \
@@ -64,12 +66,14 @@ ENV PYTHONPATH=/app \
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"]
 
18
  # Install CUDA Toolkit and cuDNN (with version matching the base image)
19
  RUN apt-get install -y cuda-toolkit-12-1 libcudnn8 libcudnn8-dev
20
 
21
+ # Create user first so we can set up their home directory
22
+ RUN useradd -m -u 1000 user
23
+
24
+ # Set environment variables including HOME
25
+ ENV HOME=/home/user \
26
+ PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \
27
  CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
28
  CUDA_HOME=/usr/local/cuda \
29
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
30
  CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/" \
31
  TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;8.9;9.0"
32
 
33
+ # Create app directory structure but don't switch to user yet
34
+ RUN mkdir -p /home/user/app/checkpoints && \
35
+ chown -R user:user /home/user
36
 
37
+ # Clone the repository directly into the app directory (as root for now)
38
+ RUN git clone -b dev https://github.com/fffiloni/dreamtalk /home/user/app && \
39
+ chown -R user:user /home/user/app
40
 
41
+ # Download model checkpoints (as root)
42
+ RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O /home/user/app/checkpoints/denoising_network.pth && \
43
+ wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O /home/user/app/checkpoints/renderer.pt && \
44
+ chown -R user:user /home/user/app/checkpoints
45
 
46
+ # Switch to user for pip installations
47
+ USER user
48
+ WORKDIR $HOME
49
+
50
+ # Upgrade pip & install dependencies
51
+ RUN pip install --upgrade pip setuptools wheel
52
+ 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
53
 
54
  # Explicitly set environment variables for dlib compilation
55
  ENV DLIB_USE_CUDA=1 \
56
  DLIB_JPEG_SUPPORT=1 \
57
+ DLIB_PNG_SUPPORT=1 \
58
+ PYTHONPATH=$HOME/app \
 
 
 
 
 
 
 
 
 
59
  PYTHONUNBUFFERED=1 \
60
  GRADIO_ALLOW_FLAGGING=never \
61
  GRADIO_NUM_PORTS=1 \
 
66
  CUDA_DEVICE_ORDER=PCI_BUS_ID \
67
  CUDA_VISIBLE_DEVICES=0
68
 
69
+ # Install dlib with CUDA support
70
+ RUN pip install --no-cache-dir dlib==19.24.0
71
+
72
+ # Set working directory to app
73
+ WORKDIR $HOME/app
74
 
75
  # Copy application file (assuming it's in the build context)
76
+ COPY --chown=user:user app.py $HOME/app/
77
 
78
  # Run the application
79
  CMD ["python", "app.py"]