Update Dockerfile
Browse files- Dockerfile +53 -65
Dockerfile
CHANGED
@@ -1,107 +1,95 @@
|
|
1 |
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
-
|
|
|
5 |
|
6 |
-
# Remove any third-party apt sources
|
7 |
-
# Install some basic utilities
|
8 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
apt-get update && apt-get install -y --no-install-recommends \
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
&& rm -rf /var/lib/apt/lists/*
|
30 |
|
|
|
31 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
32 |
apt-get upgrade -y && \
|
33 |
apt-get install -y --no-install-recommends nvtop
|
34 |
|
35 |
-
|
|
|
36 |
apt-get install -y nodejs && \
|
37 |
npm install -g configurable-http-proxy
|
38 |
|
39 |
-
#
|
40 |
WORKDIR /app
|
41 |
|
42 |
-
#
|
43 |
-
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
44 |
-
&& chown -R user:user /app
|
45 |
-
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
46 |
-
USER user
|
47 |
-
|
48 |
-
# All users can use /home/user as their home directory
|
49 |
-
ENV HOME=/home/user
|
50 |
-
RUN mkdir $HOME/.cache $HOME/.config \
|
51 |
-
&& chmod -R 777 $HOME
|
52 |
-
|
53 |
-
# Set up the Conda environment
|
54 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
55 |
-
PATH
|
56 |
-
RUN curl -sLo
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
WORKDIR
|
63 |
|
64 |
#######################################
|
65 |
-
#
|
66 |
#######################################
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
# User Debian packages
|
71 |
-
## Security warning : Potential user code executed as root (build time)
|
72 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
73 |
apt-get update && \
|
74 |
-
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
75 |
-
|
76 |
|
|
|
77 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
78 |
-
|
79 |
|
80 |
-
|
|
|
81 |
|
82 |
#######################################
|
83 |
-
#
|
84 |
#######################################
|
85 |
|
86 |
-
USER user
|
87 |
-
|
88 |
-
# Python packages
|
89 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
90 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
91 |
|
92 |
-
# Copy the current directory contents into
|
93 |
-
COPY
|
94 |
|
95 |
RUN chmod +x start_server.sh
|
96 |
|
97 |
-
|
|
|
98 |
|
99 |
ENV PYTHONUNBUFFERED=1 \
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
|
107 |
CMD ["./start_server.sh"]
|
|
|
1 |
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
+
TZ=Europe/Paris \
|
5 |
+
HOME=/root
|
6 |
|
7 |
+
# Remove any third-party apt sources and install basic utilities
|
|
|
8 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
apt-get update && apt-get install -y --no-install-recommends \
|
10 |
+
curl \
|
11 |
+
ca-certificates \
|
12 |
+
sudo \
|
13 |
+
git \
|
14 |
+
wget \
|
15 |
+
procps \
|
16 |
+
git-lfs \
|
17 |
+
zip \
|
18 |
+
aria2 \
|
19 |
+
unzip \
|
20 |
+
ffmpeg \
|
21 |
+
htop \
|
22 |
+
vim \
|
23 |
+
nano \
|
24 |
+
bzip2 \
|
25 |
+
libx11-6 \
|
26 |
+
build-essential \
|
27 |
+
libsndfile-dev \
|
28 |
+
software-properties-common \
|
29 |
&& rm -rf /var/lib/apt/lists/*
|
30 |
|
31 |
+
# Install nvtop
|
32 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
33 |
apt-get upgrade -y && \
|
34 |
apt-get install -y --no-install-recommends nvtop
|
35 |
|
36 |
+
# Install Node.js and configurable-http-proxy
|
37 |
+
RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
|
38 |
apt-get install -y nodejs && \
|
39 |
npm install -g configurable-http-proxy
|
40 |
|
41 |
+
# Set working directory
|
42 |
WORKDIR /app
|
43 |
|
44 |
+
# Install Conda in /root/miniconda and update PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
46 |
+
PATH=/root/miniconda/bin:$PATH
|
47 |
+
RUN curl -sLo /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh && \
|
48 |
+
chmod +x /tmp/miniconda.sh && \
|
49 |
+
/tmp/miniconda.sh -b -p /root/miniconda && \
|
50 |
+
rm /tmp/miniconda.sh && \
|
51 |
+
conda clean -ya
|
52 |
|
53 |
+
WORKDIR /app
|
54 |
|
55 |
#######################################
|
56 |
+
# Additional root-level operations
|
57 |
#######################################
|
58 |
|
59 |
+
# Install extra Debian packages (packages.txt must be provided)
|
|
|
|
|
|
|
60 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
61 |
apt-get update && \
|
62 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends && \
|
63 |
+
rm -rf /var/lib/apt/lists/*
|
64 |
|
65 |
+
# Run startup script (if provided)
|
66 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
67 |
+
bash /root/on_startup.sh
|
68 |
|
69 |
+
# Create data directory
|
70 |
+
RUN mkdir /data
|
71 |
|
72 |
#######################################
|
73 |
+
# Python packages and application files
|
74 |
#######################################
|
75 |
|
|
|
|
|
|
|
76 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
77 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
78 |
|
79 |
+
# Copy the current directory contents into /app
|
80 |
+
COPY . /app
|
81 |
|
82 |
RUN chmod +x start_server.sh
|
83 |
|
84 |
+
# Overwrite Jupyter's login template if needed
|
85 |
+
COPY login.html /root/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
86 |
|
87 |
ENV PYTHONUNBUFFERED=1 \
|
88 |
+
GRADIO_ALLOW_FLAGGING=never \
|
89 |
+
GRADIO_NUM_PORTS=1 \
|
90 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
91 |
+
GRADIO_THEME=huggingface \
|
92 |
+
SYSTEM=spaces \
|
93 |
+
SHELL=/bin/bash
|
94 |
|
95 |
CMD ["./start_server.sh"]
|