fffiloni commited on
Commit
37d22bb
·
verified ·
1 Parent(s): d71d978

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -28
Dockerfile CHANGED
@@ -25,49 +25,53 @@ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86
25
  # Install CUDA Toolkit and cuDNN
26
  RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev
27
 
28
- # Create a user
29
- RUN useradd -m -u 1000 user
30
- USER user
31
-
32
  # Set CUDA paths
33
- ENV HOME=/home/user \
34
- PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \
35
- PYTHONPATH=$HOME/app \
36
- PYTHONUNBUFFERED=1 \
37
- GRADIO_ALLOW_FLAGGING=never \
38
- GRADIO_NUM_PORTS=1 \
39
- GRADIO_SERVER_NAME=0.0.0.0 \
40
- GRADIO_THEME=huggingface \
41
- GRADIO_SHARE=False \
42
- SYSTEM=spaces \
43
  CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
44
  CUDA_HOME=/usr/local/cuda \
45
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
46
- TORCH_CUDA_ARCH_LIST="8.6"
47
-
48
- # Set CUDA & cuDNN paths
49
- ENV CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
50
 
51
  # Set working directory
52
- WORKDIR $HOME/app
53
 
54
  # Clone the repository
55
- RUN git clone -b dev https://github.com/fffiloni/dreamtalk $HOME/app
 
 
 
56
 
57
  # Download model checkpoints
58
- RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O $HOME/app/checkpoints/denoising_network.pth
59
- RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O $HOME/app/checkpoints/renderer.pt
60
 
61
  # Install dependencies using Python 3.9
62
  RUN python3.9 -m pip install --no-cache-dir urllib3 transformers yacs scipy scikit-image scikit-learn \
63
  PyYAML Pillow "numpy<2" opencv-python imageio ffmpeg-python av "moviepy<2" gradio cmake dlib==19.24.0 -vvv
64
 
65
- # Copy application file
66
- COPY app.py .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- # Set CUDA environment variables
69
- ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
70
- ENV CUDA_VISIBLE_DEVICES=0
71
 
72
  # Run the application
73
- CMD ["python3.9", "app.py"]
 
25
  # Install CUDA Toolkit and cuDNN
26
  RUN apt-get install -y cuda-toolkit-11-7 libcudnn8 libcudnn8-dev
27
 
 
 
 
 
28
  # Set CUDA paths
29
+ ENV PATH=/usr/local/cuda/bin:$PATH \
 
 
 
 
 
 
 
 
 
30
  CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
31
  CUDA_HOME=/usr/local/cuda \
32
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
33
+ TORCH_CUDA_ARCH_LIST="8.6" \
34
+ CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
 
 
35
 
36
  # Set working directory
37
+ WORKDIR /app
38
 
39
  # Clone the repository
40
+ RUN git clone -b dev https://github.com/fffiloni/dreamtalk /app
41
+
42
+ # Create checkpoints directory if it doesn't exist
43
+ RUN mkdir -p /app/checkpoints
44
 
45
  # Download model checkpoints
46
+ RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O /app/checkpoints/denoising_network.pth && \
47
+ wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O /app/checkpoints/renderer.pt
48
 
49
  # Install dependencies using Python 3.9
50
  RUN python3.9 -m pip install --no-cache-dir urllib3 transformers yacs scipy scikit-image scikit-learn \
51
  PyYAML Pillow "numpy<2" opencv-python imageio ffmpeg-python av "moviepy<2" gradio cmake dlib==19.24.0 -vvv
52
 
53
+ # Create a user and change ownership
54
+ RUN useradd -m -u 1000 user && \
55
+ chown -R user:user /app
56
+
57
+ # Set Gradio and CUDA environment variables
58
+ ENV PYTHONPATH=/app \
59
+ PYTHONUNBUFFERED=1 \
60
+ GRADIO_ALLOW_FLAGGING=never \
61
+ GRADIO_NUM_PORTS=1 \
62
+ GRADIO_SERVER_NAME=0.0.0.0 \
63
+ GRADIO_THEME=huggingface \
64
+ GRADIO_SHARE=False \
65
+ SYSTEM=spaces \
66
+ CUDA_DEVICE_ORDER=PCI_BUS_ID \
67
+ CUDA_VISIBLE_DEVICES=0
68
+
69
+ # Switch to non-root user
70
+ USER user
71
 
72
+ # This assumes app.py is in your build context
73
+ # If not, you need to create or copy the app.py file appropriately
74
+ COPY --chown=user:user app.py /app/
75
 
76
  # Run the application
77
+ CMD ["python3.9", "app.py"]