Update Dockerfile
Browse files- Dockerfile +11 -5
Dockerfile
CHANGED
@@ -25,8 +25,10 @@ ENV HOME=/home/user \
|
|
25 |
# Set the working directory to the user's home directory
|
26 |
WORKDIR $HOME/app
|
27 |
|
28 |
-
#
|
29 |
USER root
|
|
|
|
|
30 |
RUN apt-get update && apt-get install -y \
|
31 |
wget \
|
32 |
curl \
|
@@ -35,6 +37,8 @@ RUN apt-get update && apt-get install -y \
|
|
35 |
gnupg \
|
36 |
libgl1-mesa-glx \
|
37 |
libglib2.0-0 \
|
|
|
|
|
38 |
python3.9 \
|
39 |
python3.9-distutils \
|
40 |
python3.9-dev \
|
@@ -43,7 +47,7 @@ RUN apt-get update && apt-get install -y \
|
|
43 |
&& update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip 1 \
|
44 |
&& apt-get clean
|
45 |
|
46 |
-
# Install CUDA 11.8 and cuDNN 9.3.0
|
47 |
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | gpg --batch --yes --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg \
|
48 |
&& echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" > /etc/apt/sources.list.d/cuda.list \
|
49 |
&& apt-get update && apt-get install -y \
|
@@ -55,15 +59,17 @@ RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu22
|
|
55 |
# Verify CUDA and cuDNN installation
|
56 |
RUN dpkg-query -W libcudnn9
|
57 |
|
58 |
-
#
|
59 |
USER user
|
|
|
|
|
60 |
COPY . .
|
61 |
RUN pip install --upgrade pip
|
62 |
RUN pip install -r requirements.txt
|
63 |
RUN pip install gradio
|
64 |
|
65 |
USER root
|
66 |
-
# Configure git to trust the directory
|
67 |
RUN git config --global --add safe.directory /home/user/app
|
68 |
RUN chown -R user:user /home/user/app
|
69 |
|
@@ -74,4 +80,4 @@ ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
|
74 |
ENV CUDA_VISIBLE_DEVICES=0
|
75 |
|
76 |
# Command to run your application
|
77 |
-
CMD ["python", "app.py"]
|
|
|
25 |
# Set the working directory to the user's home directory
|
26 |
WORKDIR $HOME/app
|
27 |
|
28 |
+
# Switch to root to install system dependencies
|
29 |
USER root
|
30 |
+
|
31 |
+
# Install basic dependencies and add deadsnakes repository for Python 3.9
|
32 |
RUN apt-get update && apt-get install -y \
|
33 |
wget \
|
34 |
curl \
|
|
|
37 |
gnupg \
|
38 |
libgl1-mesa-glx \
|
39 |
libglib2.0-0 \
|
40 |
+
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
41 |
+
&& apt-get update && apt-get install -y \
|
42 |
python3.9 \
|
43 |
python3.9-distutils \
|
44 |
python3.9-dev \
|
|
|
47 |
&& update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip 1 \
|
48 |
&& apt-get clean
|
49 |
|
50 |
+
# Install CUDA 11.8 and cuDNN 9.3.0
|
51 |
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | gpg --batch --yes --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg \
|
52 |
&& echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" > /etc/apt/sources.list.d/cuda.list \
|
53 |
&& apt-get update && apt-get install -y \
|
|
|
59 |
# Verify CUDA and cuDNN installation
|
60 |
RUN dpkg-query -W libcudnn9
|
61 |
|
62 |
+
# Switch back to the user
|
63 |
USER user
|
64 |
+
|
65 |
+
# Install Python dependencies
|
66 |
COPY . .
|
67 |
RUN pip install --upgrade pip
|
68 |
RUN pip install -r requirements.txt
|
69 |
RUN pip install gradio
|
70 |
|
71 |
USER root
|
72 |
+
# Configure git to trust the directory and set ownership
|
73 |
RUN git config --global --add safe.directory /home/user/app
|
74 |
RUN chown -R user:user /home/user/app
|
75 |
|
|
|
80 |
ENV CUDA_VISIBLE_DEVICES=0
|
81 |
|
82 |
# Command to run your application
|
83 |
+
CMD ["python", "app.py"]
|