nateraw commited on
Commit
e6cea19
1 Parent(s): 49733f0

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -21
Dockerfile CHANGED
@@ -1,13 +1,12 @@
1
  FROM nvidia/cuda:11.3.1-base-ubuntu20.04
2
 
3
- # Remove any third-party apt sources to avoid issues with expiring keys.
4
- RUN rm -f /etc/apt/sources.list.d/*.list
5
-
6
  ENV DEBIAN_FRONTEND=noninteractive \
7
  TZ=Europe/Paris
8
 
 
9
  # Install some basic utilities
10
- RUN apt-get update && apt-get install -y \
 
11
  curl \
12
  ca-certificates \
13
  sudo \
@@ -23,16 +22,15 @@ RUN apt-get update && apt-get install -y \
23
  software-properties-common \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
- RUN add-apt-repository ppa:flexiondotorg/nvtop
27
- RUN apt-get upgrade -y
28
- RUN apt-get install -y nvtop
29
 
30
- RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
31
- RUN apt-get install -y nodejs
32
- RUN npm install -g configurable-http-proxy
33
 
34
  # Create a working directory
35
- RUN mkdir /app
36
  WORKDIR /app
37
 
38
  # Create a non-root user and switch to it
@@ -65,15 +63,13 @@ USER root
65
 
66
  # User Debian packages
67
  ## Security warning : Potential user code executed as root (build time)
68
- COPY --chown=root packages.txt /root/packages.txt
69
- RUN apt-get update && xargs -r -a /root/packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
 
 
70
 
71
- COPY --chown=root on_startup.sh /root/on_startup.sh
72
- RUN chmod +x /root/on_startup.sh
73
- RUN /root/on_startup.sh
74
-
75
- # Rerun chmod on home dir in case any new files need permisisons
76
- RUN chmod -R 777 $HOME
77
 
78
  #######################################
79
  # End root user section
@@ -81,12 +77,15 @@ RUN chmod -R 777 $HOME
81
 
82
  USER user
83
 
 
 
 
 
84
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
85
  COPY --chown=user . $HOME/app
86
 
87
  RUN chmod +x start_server.sh
88
 
89
- RUN pip install --no-cache-dir --upgrade -r $HOME/app/requirements.txt
90
  COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
91
 
92
  ENV PYTHONUNBUFFERED=1 \
@@ -97,4 +96,4 @@ ENV PYTHONUNBUFFERED=1 \
97
  SYSTEM=spaces \
98
  SHELL=/bin/bash
99
 
100
- CMD ["./start_server.sh"]
 
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 \
 
22
  software-properties-common \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
26
+ apt-get upgrade -y && \
27
+ apt-get install -y --no-install-recommends nvtop
28
 
29
+ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
30
+ apt-get install -y nodejs && \
31
+ npm install -g configurable-http-proxy
32
 
33
  # Create a working directory
 
34
  WORKDIR /app
35
 
36
  # Create a non-root user and switch to it
 
63
 
64
  # User Debian packages
65
  ## Security warning : Potential user code executed as root (build time)
66
+ RUN --mount=target=/root/packages.txt,source=packages.txt \
67
+ apt-get update && \
68
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
69
+ && rm -rf /var/lib/apt/lists/*
70
 
71
+ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
72
+ bash /root/on_startup.sh
 
 
 
 
73
 
74
  #######################################
75
  # End root user section
 
77
 
78
  USER user
79
 
80
+ # Python packages
81
+ RUN --mount=target=requirements.txt,source=requirements.txt \
82
+ pip install --no-cache-dir --upgrade -r requirements.txt
83
+
84
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
85
  COPY --chown=user . $HOME/app
86
 
87
  RUN chmod +x start_server.sh
88
 
 
89
  COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
90
 
91
  ENV PYTHONUNBUFFERED=1 \
 
96
  SYSTEM=spaces \
97
  SHELL=/bin/bash
98
 
99
+ CMD ["./start_server.sh"]