Update Dockerfile
Browse files- Dockerfile +97 -3
Dockerfile
CHANGED
@@ -1,9 +1,103 @@
|
|
1 |
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
|
|
2 |
ENV DEBIAN_FRONTEND=noninteractive \
|
3 |
TZ=Europe/Paris
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
USER root
|
5 |
-
RUN apt-get update && apt-get install -y glances
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
CMD ["glances", "-w", "--bind=0.0.0.0:7860"]
|
|
|
1 |
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
2 |
+
|
3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
TZ=Europe/Paris
|
5 |
+
|
6 |
+
# Remove any third-party apt sources to avoid issues with expiring keys.
|
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 |
+
curl \
|
11 |
+
ca-certificates \
|
12 |
+
sudo \
|
13 |
+
git \
|
14 |
+
wget \
|
15 |
+
procps \
|
16 |
+
git-lfs \
|
17 |
+
zip \
|
18 |
+
unzip \
|
19 |
+
sysbench \
|
20 |
+
htop \
|
21 |
+
nload \
|
22 |
+
glances \
|
23 |
+
vim \
|
24 |
+
nmap \
|
25 |
+
neofetch \
|
26 |
+
nano \
|
27 |
+
bzip2 \
|
28 |
+
libx11-6 \
|
29 |
+
build-essential \
|
30 |
+
libsndfile-dev \
|
31 |
+
software-properties-common \
|
32 |
+
&& rm -rf /var/lib/apt/lists/*
|
33 |
+
|
34 |
+
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
35 |
+
apt-get upgrade -y && \
|
36 |
+
apt-get install -y --no-install-recommends nvtop
|
37 |
+
|
38 |
+
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
39 |
+
apt-get install -y nodejs && \
|
40 |
+
npm install -g configurable-http-proxy
|
41 |
+
|
42 |
+
# Create a working directory
|
43 |
+
WORKDIR /app
|
44 |
+
|
45 |
+
# Create a non-root user and switch to it
|
46 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
47 |
+
&& chown -R user:user /app
|
48 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
49 |
+
USER user
|
50 |
+
|
51 |
+
# All users can use /home/user as their home directory
|
52 |
+
ENV HOME=/home/user
|
53 |
+
RUN mkdir $HOME/.cache $HOME/.config \
|
54 |
+
&& chmod -R 777 $HOME
|
55 |
+
|
56 |
+
# Set up the Conda environment
|
57 |
+
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
58 |
+
PATH=$HOME/miniconda/bin:$PATH
|
59 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
60 |
+
&& chmod +x ~/miniconda.sh \
|
61 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
62 |
+
&& rm ~/miniconda.sh \
|
63 |
+
&& conda clean -ya
|
64 |
+
|
65 |
+
WORKDIR $HOME/app
|
66 |
+
|
67 |
+
#######################################
|
68 |
+
# Start root user section
|
69 |
+
#######################################
|
70 |
+
|
71 |
USER root
|
|
|
72 |
|
73 |
+
# User Debian packages
|
74 |
+
## Security warning : Potential user code executed as root (build time)
|
75 |
+
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
76 |
+
apt-get update && \
|
77 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
78 |
+
&& rm -rf /var/lib/apt/lists/*
|
79 |
+
|
80 |
+
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
81 |
+
bash /root/on_startup.sh
|
82 |
+
|
83 |
+
RUN mkdir /data && chown user:user /data
|
84 |
+
|
85 |
+
#######################################
|
86 |
+
# End root user section
|
87 |
+
#######################################
|
88 |
+
|
89 |
+
USER user
|
90 |
+
|
91 |
+
# Python packages
|
92 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
93 |
+
COPY --chown=user . $HOME/app
|
94 |
+
|
95 |
+
ENV PYTHONUNBUFFERED=1 \
|
96 |
+
GRADIO_ALLOW_FLAGGING=never \
|
97 |
+
GRADIO_NUM_PORTS=1 \
|
98 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
99 |
+
GRADIO_THEME=huggingface \
|
100 |
+
SYSTEM=spaces \
|
101 |
+
SHELL=/bin/bash
|
102 |
|
103 |
+
CMD ["glances", "-w", "--bind=0.0.0.0:7860"]
|