fffiloni commited on
Commit
f82f269
·
verified ·
1 Parent(s): a91384a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -47
Dockerfile CHANGED
@@ -1,38 +1,12 @@
 
1
  FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive
4
- ENV MKL_THREADING_LAYER=GNU
5
-
6
- # Install dependencies
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.9 python3.9-dev python3.9-venv \
10
- software-properties-common wget gnupg2 libopenblas-dev && \
11
- rm -rf /var/lib/apt/lists/*
12
-
13
- # Ensure Python 3.9 is the default version
14
- RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
15
- update-alternatives --set python3 /usr/bin/python3.9
16
-
17
- # Install pip for Python 3.9
18
- RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9
19
-
20
- # Add NVIDIA package repositories
21
- RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
22
- dpkg -i cuda-keyring_1.0-1_all.deb && \
23
- apt-get update
24
-
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 \
@@ -43,32 +17,59 @@ ENV HOME=/home/user \
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
- # Upgrade pip & install dependencies
62
  COPY requirements_HF.txt .
63
- RUN pip install -r requirements_HF.txt
64
- RUN pip install --no-cache-dir "moviepy<2" gradio
65
 
66
- # Copy application file
67
  COPY app.py .
68
 
69
  # Set CUDA environment variables
70
- ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
71
- ENV CUDA_VISIBLE_DEVICES=0
72
 
73
  # Run the application
74
- CMD ["python", "app.py"]
 
1
+ # Use the official PyTorch image as the base
2
  FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
3
 
4
+ # Set environment variables
5
+ ENV DEBIAN_FRONTEND=noninteractive \
6
+ MKL_THREADING_LAYER=GNU \
7
+ HOME=/home/user \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  PATH=/home/user/.local/bin:/usr/local/cuda/bin:$PATH \
9
+ PYTHONPATH=/home/user/app \
10
  PYTHONUNBUFFERED=1 \
11
  GRADIO_ALLOW_FLAGGING=never \
12
  GRADIO_NUM_PORTS=1 \
 
17
  CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
18
  CUDA_HOME=/usr/local/cuda \
19
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
20
+ TORCH_CUDA_ARCH_LIST="8.6" \
21
+ CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
22
+
23
+ # Install Python 3.9 and necessary dependencies
24
+ RUN apt-get update && \
25
+ apt-get install -y --no-install-recommends \
26
+ python3.9 python3.9-dev python3.9-venv \
27
+ git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
28
+ build-essential cmake g++ software-properties-common gnupg2 libopenblas-dev && \
29
+ rm -rf /var/lib/apt/lists/*
30
 
31
+ # Set Python 3.9 as the default python3 and install pip
32
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
33
+ update-alternatives --set python3 /usr/bin/python3.9 && \
34
+ curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9 && \
35
+ ln -sf /usr/bin/python3.9 /usr/bin/python && \
36
+ ln -sf /usr/local/bin/pip /usr/bin/pip3
37
+
38
+ # Add NVIDIA package repositories and install CUDA Toolkit and cuDNN
39
+ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
40
+ dpkg -i cuda-keyring_1.0-1_all.deb && \
41
+ apt-get update && \
42
+ apt-get install -y --no-install-recommends cuda-toolkit-11-7 libcudnn8 libcudnn8-dev && \
43
+ rm -rf /var/lib/apt/lists/*
44
+
45
+ # Create a non-root user
46
+ RUN useradd -m -u 1000 user
47
+
48
+ # Switch to the new user
49
+ USER user
50
 
51
+ # Set the working directory
52
+ WORKDIR /home/user/app
53
 
54
  # Clone the repository
55
+ RUN git clone -b dev https://github.com/fffiloni/dreamtalk .
56
 
57
  # Download model checkpoints
58
+ RUN mkdir -p checkpoints && \
59
+ wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O checkpoints/denoising_network.pth && \
60
+ wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O checkpoints/renderer.pt
61
 
62
+ # Copy and install Python dependencies
63
  COPY requirements_HF.txt .
64
+ RUN pip install --no-cache-dir -r requirements_HF.txt && \
65
+ pip install --no-cache-dir "moviepy<2" gradio
66
 
67
+ # Copy the application file
68
  COPY app.py .
69
 
70
  # Set CUDA environment variables
71
+ ENV CUDA_DEVICE_ORDER=PCI_BUS_ID \
72
+ CUDA_VISIBLE_DEVICES=0
73
 
74
  # Run the application
75
+ CMD ["python", "app.py"]