Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +29 -71
Dockerfile
CHANGED
@@ -1,86 +1,44 @@
|
|
1 |
-
# Use the official PyTorch image as the base
|
2 |
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
3 |
|
4 |
-
|
5 |
-
ENV DEBIAN_FRONTEND=noninteractive \
|
6 |
-
MKL_THREADING_LAYER=GNU \
|
7 |
-
HOME=/home/user \
|
8 |
-
PYTHONPATH=/home/user/app \
|
9 |
-
PYTHONUNBUFFERED=1 \
|
10 |
-
GRADIO_ALLOW_FLAGGING=never \
|
11 |
-
GRADIO_NUM_PORTS=1 \
|
12 |
-
GRADIO_SERVER_NAME=0.0.0.0 \
|
13 |
-
GRADIO_THEME=huggingface \
|
14 |
-
GRADIO_SHARE=False \
|
15 |
-
SYSTEM=spaces \
|
16 |
-
CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
|
17 |
-
CUDA_HOME=/usr/local/cuda \
|
18 |
-
LD_LIBRARY_PATH=/usr/local/cuda/lib64 \
|
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 takes precedence over 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
|
35 |
-
|
36 |
-
update-alternatives --set python3 /usr/bin/python3.9 && \
|
37 |
-
wget -qO- https://bootstrap.pypa.io/get-pip.py | python3.9 && \
|
38 |
-
ln -sf /usr/bin/python3.9 /usr/bin/python && \
|
39 |
-
ln -sf /usr/bin/pip3 /usr/bin/pip
|
40 |
|
41 |
-
|
42 |
-
RUN python3.9 -m pip install --upgrade pip setuptools wheel
|
43 |
|
44 |
-
# Add NVIDIA package repositories and install CUDA Toolkit and cuDNN
|
45 |
-
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb && \
|
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 |
-
|
57 |
-
RUN mkdir -p /home/user/.local /home/user/.cache && chmod -R 755 /home/user/.local /home/user/.cache
|
58 |
-
|
59 |
-
# Set working directory
|
60 |
-
WORKDIR /home/user/app
|
61 |
-
|
62 |
-
# Clone the repository
|
63 |
-
RUN git clone -b dev https://github.com/fffiloni/dreamtalk .
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
#
|
71 |
-
|
72 |
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
74 |
COPY requirements_HF.txt .
|
75 |
-
RUN
|
76 |
-
python3.9 -m pip install --no-cache-dir "moviepy<2" gradio
|
77 |
|
78 |
-
# Copy the application file
|
79 |
COPY app.py .
|
80 |
|
81 |
-
# Set
|
82 |
-
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
83 |
-
|
84 |
|
85 |
-
# Run
|
86 |
-
CMD ["
|
|
|
|
|
1 |
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
2 |
|
3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
# Set the MKL_THREADING_LAYER environment variable to GNU
|
6 |
+
ENV MKL_THREADING_LAYER=GNU
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
RUN apt-get update && apt-get install -y git wget libgl1-mesa-glx libglib2.0-0 ffmpeg libx264-dev build-essential cmake
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
RUN useradd -m -u 1000 user
|
|
|
11 |
|
12 |
+
USER user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
ENV HOME=/home/user \
|
15 |
+
PATH=/home/user/.local/bin:$PATH \
|
16 |
+
PYTHONPATH=$HOME/app \
|
17 |
+
PYTHONUNBUFFERED=1 \
|
18 |
+
GRADIO_ALLOW_FLAGGING=never \
|
19 |
+
GRADIO_NUM_PORTS=1 \
|
20 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
21 |
+
GRADIO_THEME=huggingface \
|
22 |
+
GRADIO_SHARE=False \
|
23 |
+
SYSTEM=spaces
|
24 |
|
25 |
+
# Set the working directory to the user's home directory
|
26 |
+
WORKDIR $HOME/app
|
27 |
|
28 |
+
RUN git clone -b dev https://github.com/fffiloni/dreamtalk $HOME/app
|
29 |
+
|
30 |
+
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/denoising_network.pth -O $HOME/app/checkpoints/denoising_network.pth
|
31 |
+
RUN wget https://huggingface.co/camenduru/dreamtalk/resolve/main/damo/dreamtalk/checkpoints/renderer.pt -O $HOME/app/checkpoints/renderer.pt
|
32 |
+
|
33 |
+
# Install dependencies
|
34 |
COPY requirements_HF.txt .
|
35 |
+
RUN pip install --no-cache-dir -r requirements_HF.txt
|
|
|
36 |
|
|
|
37 |
COPY app.py .
|
38 |
|
39 |
+
# Set the environment variable to specify the GPU device
|
40 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
41 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
42 |
|
43 |
+
# Run your app.py script
|
44 |
+
CMD ["python", "app.py"]
|