fffiloni commited on
Commit
7eb5f33
·
verified ·
1 Parent(s): c34e2a8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -16
Dockerfile CHANGED
@@ -19,19 +19,19 @@ ENV DEBIAN_FRONTEND=noninteractive \
19
  TORCH_CUDA_ARCH_LIST="8.6" \
20
  CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
21
 
22
- # Override PATH so that the system's /usr/bin (with Python 3.9) is used instead of Conda's
23
  ENV PATH="/usr/local/cuda/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin"
24
 
25
- # Install Python 3.9 and build dependencies (including for NumPy)
26
  RUN apt-get update && \
27
  apt-get install -y --no-install-recommends \
28
- python3.9 python3.9-dev python3.9-venv \
29
- git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
30
- build-essential gfortran libopenblas-dev liblapack-dev \
31
- cmake g++ software-properties-common gnupg2 && \
32
  rm -rf /var/lib/apt/lists/*
33
 
34
- # Set Python 3.9 as the default python3 and install pip for it
35
  RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
36
  update-alternatives --set python3 /usr/bin/python3.9 && \
37
  curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9 && \
@@ -46,16 +46,14 @@ RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86
46
  dpkg -i cuda-keyring_1.0-1_all.deb && \
47
  apt-get update && \
48
  apt-get install -y --no-install-recommends \
49
- cuda-toolkit-11-7 libcudnn8 libcudnn8-dev && \
50
  rm -rf /var/lib/apt/lists/*
51
 
52
- # Create a non-root user
53
  RUN useradd -m -u 1000 user
54
-
55
- # Switch to the new user
56
  USER user
57
 
58
- # Set the working directory
59
  WORKDIR /home/user/app
60
 
61
  # Clone the repository
@@ -66,8 +64,8 @@ RUN mkdir -p checkpoints && \
66
  wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O checkpoints/denoising_network.pth && \
67
  wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O checkpoints/renderer.pt
68
 
69
- # Install NumPy first (to help avoid build issues)
70
- RUN python3.9 -m pip install numpy
71
 
72
  # Copy and install remaining Python dependencies
73
  COPY requirements_HF.txt .
@@ -77,9 +75,9 @@ RUN python3.9 -m pip install --no-cache-dir -r requirements_HF.txt && \
77
  # Copy the application file
78
  COPY app.py .
79
 
80
- # Set CUDA environment variables (if needed)
81
  ENV CUDA_DEVICE_ORDER=PCI_BUS_ID \
82
  CUDA_VISIBLE_DEVICES=0
83
 
84
- # Run the application with Python 3.9 explicitly
85
  CMD ["python3.9", "app.py"]
 
19
  TORCH_CUDA_ARCH_LIST="8.6" \
20
  CMAKE_PREFIX_PATH="/usr/local/cuda:/usr/lib/x86_64-linux-gnu/"
21
 
22
+ # Override PATH so that system Python 3.9 is used in favor of Conda's Python 3.10
23
  ENV PATH="/usr/local/cuda/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin"
24
 
25
+ # Install Python 3.9 and build dependencies (including those needed for NumPy)
26
  RUN apt-get update && \
27
  apt-get install -y --no-install-recommends \
28
+ python3.9 python3.9-dev python3.9-venv \
29
+ git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev pkg-config \
30
+ build-essential gfortran libopenblas-dev liblapack-dev \
31
+ cmake g++ software-properties-common gnupg2 && \
32
  rm -rf /var/lib/apt/lists/*
33
 
34
+ # Set Python 3.9 as default for python3, install pip, and create symlinks
35
  RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
36
  update-alternatives --set python3 /usr/bin/python3.9 && \
37
  curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9 && \
 
46
  dpkg -i cuda-keyring_1.0-1_all.deb && \
47
  apt-get update && \
48
  apt-get install -y --no-install-recommends \
49
+ cuda-toolkit-11-7 libcudnn8 libcudnn8-dev && \
50
  rm -rf /var/lib/apt/lists/*
51
 
52
+ # Create a non-root user and switch to it
53
  RUN useradd -m -u 1000 user
 
 
54
  USER user
55
 
56
+ # Set working directory
57
  WORKDIR /home/user/app
58
 
59
  # Clone the repository
 
64
  wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O checkpoints/denoising_network.pth && \
65
  wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O checkpoints/renderer.pt
66
 
67
+ # Pre-install NumPy (version as specified in requirements_HF.txt) to avoid build issues
68
+ RUN python3.9 -m pip install numpy==1.26.4
69
 
70
  # Copy and install remaining Python dependencies
71
  COPY requirements_HF.txt .
 
75
  # Copy the application file
76
  COPY app.py .
77
 
78
+ # Set additional CUDA environment variables if needed
79
  ENV CUDA_DEVICE_ORDER=PCI_BUS_ID \
80
  CUDA_VISIBLE_DEVICES=0
81
 
82
+ # Run the application explicitly with Python 3.9
83
  CMD ["python3.9", "app.py"]