Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +111 -4
Dockerfile
CHANGED
@@ -1,6 +1,113 @@
|
|
1 |
-
FROM
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
RUN npm install express uuid memory-fs
|
4 |
-
COPY . .
|
5 |
-
EXPOSE 7860
|
6 |
CMD ["node", "temp"]
|
|
|
1 |
+
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
2 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
3 |
+
TZ=Europe/Paris
|
4 |
+
|
5 |
+
# Remove any third-party apt sources to avoid issues with expiring keys.
|
6 |
+
# Install some basic utilities
|
7 |
+
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
8 |
+
apt-get update && apt-get install -y --no-install-recommends \
|
9 |
+
curl \
|
10 |
+
ca-certificates \
|
11 |
+
sudo \
|
12 |
+
git \
|
13 |
+
wget \
|
14 |
+
procps \
|
15 |
+
git-lfs \
|
16 |
+
zip \
|
17 |
+
unzip \
|
18 |
+
sysbench \
|
19 |
+
htop \
|
20 |
+
nload \
|
21 |
+
vim \
|
22 |
+
nmap \
|
23 |
+
node \
|
24 |
+
neofetch \
|
25 |
+
nano \
|
26 |
+
bzip2 \
|
27 |
+
libx11-6 \
|
28 |
+
python3-pip \
|
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 |
+
COPY ./requirements.txt /app/requirements.txt
|
45 |
+
|
46 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
47 |
+
|
48 |
+
# Create a non-root user and switch to it
|
49 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
50 |
+
&& chown -R user:user /app
|
51 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
52 |
+
USER user
|
53 |
+
|
54 |
+
# All users can use /home/user as their home directory
|
55 |
+
ENV HOME=/home/user
|
56 |
+
RUN mkdir $HOME/.cache $HOME/.config \
|
57 |
+
&& chmod -R 777 $HOME
|
58 |
+
|
59 |
+
# Set up the Conda environment
|
60 |
+
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
61 |
+
PATH=$HOME/miniconda/bin:$PATH
|
62 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
63 |
+
&& chmod +x ~/miniconda.sh \
|
64 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
65 |
+
&& rm ~/miniconda.sh \
|
66 |
+
&& conda clean -ya
|
67 |
+
|
68 |
+
WORKDIR $HOME/app
|
69 |
+
|
70 |
+
#######################################
|
71 |
+
# Start root user section
|
72 |
+
#######################################
|
73 |
+
|
74 |
+
USER root
|
75 |
+
|
76 |
+
# User Debian packages
|
77 |
+
## Security warning : Potential user code executed as root (build time)
|
78 |
+
|
79 |
+
RUN mkdir /data && chown user:user /data
|
80 |
+
RUN pip install bottle
|
81 |
+
RUN pip install glances
|
82 |
+
RUN pip install fastapi
|
83 |
+
RUN pip install uvicorn
|
84 |
+
RUN pip install Jinja2==3.1.2
|
85 |
+
RUN pip uninstall numpy -y
|
86 |
+
RUN pip install jq
|
87 |
+
RUN apt update && apt upgrade -y
|
88 |
+
RUN apt install netcat-traditional
|
89 |
+
RUN apt install bc
|
90 |
+
RUN apt install nodejs -y
|
91 |
+
|
92 |
+
RUN pip install numpy==1.26.4
|
93 |
+
#######################################
|
94 |
+
# End root user section
|
95 |
+
#######################################
|
96 |
+
|
97 |
+
USER user
|
98 |
+
|
99 |
+
# Python packages
|
100 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
101 |
+
COPY --chown=user . $HOME/app
|
102 |
+
|
103 |
+
ENV PYTHONUNBUFFERED=1 \
|
104 |
+
GRADIO_ALLOW_FLAGGING=never \
|
105 |
+
GRADIO_NUM_PORTS=1 \
|
106 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
107 |
+
GRADIO_THEME=huggingface \
|
108 |
+
SYSTEM=spaces \
|
109 |
+
SHELL=/bin/bash
|
110 |
+
|
111 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
112 |
RUN npm install express uuid memory-fs
|
|
|
|
|
113 |
CMD ["node", "temp"]
|