nateraw commited on
Commit
d887ff2
1 Parent(s): 404a713

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -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 \
@@ -56,16 +55,15 @@ RUN \
56
  /var/tmp/*
57
  COPY root/ /
58
 
59
- RUN add-apt-repository ppa:flexiondotorg/nvtop
60
- RUN apt-get upgrade -y
61
- RUN apt-get install -y nvtop
62
 
63
- RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
64
- RUN apt-get install -y nodejs
65
- RUN npm install -g configurable-http-proxy
66
 
67
  # Create a working directory
68
- RUN mkdir -p /app
69
  WORKDIR /app
70
 
71
  # Create a non-root user and switch to it
@@ -98,15 +96,13 @@ USER root
98
 
99
  # User Debian packages
100
  ## Security warning : Potential user code executed as root (build time)
101
- COPY --chown=root packages.txt /root/packages.txt
102
- RUN apt-get update && xargs -r -a /root/packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
 
 
103
 
104
- COPY --chown=root on_startup.sh /root/on_startup.sh
105
- RUN chmod +x /root/on_startup.sh
106
- RUN /root/on_startup.sh
107
-
108
- # Rerun chmod on home dir in case any new files need permisisons
109
- RUN chmod -R 777 $HOME
110
 
111
  #######################################
112
  # End root user section
@@ -114,13 +110,15 @@ RUN chmod -R 777 $HOME
114
 
115
  USER user
116
 
 
 
 
 
117
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
118
  COPY --chown=user . $HOME/app
119
 
120
  RUN chmod +x start_server.sh
121
 
122
- RUN pip install --no-cache-dir --upgrade -r $HOME/app/requirements.txt
123
-
124
  ENV PYTHONUNBUFFERED=1 \
125
  GRADIO_ALLOW_FLAGGING=never \
126
  GRADIO_NUM_PORTS=1 \
 
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 \
10
  curl \
11
  ca-certificates \
12
  sudo \
 
55
  /var/tmp/*
56
  COPY root/ /
57
 
58
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
59
+ apt-get upgrade -y && \
60
+ apt-get install -y --no-install-recommends nvtop
61
 
62
+ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
63
+ apt-get install -y nodejs && \
64
+ npm install -g configurable-http-proxy
65
 
66
  # Create a working directory
 
67
  WORKDIR /app
68
 
69
  # Create a non-root user and switch to it
 
96
 
97
  # User Debian packages
98
  ## Security warning : Potential user code executed as root (build time)
99
+ RUN --mount=target=/root/packages.txt,source=packages.txt \
100
+ apt-get update && \
101
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
102
+ && rm -rf /var/lib/apt/lists/*
103
 
104
+ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
105
+ bash /root/on_startup.sh
 
 
 
 
106
 
107
  #######################################
108
  # End root user section
 
110
 
111
  USER user
112
 
113
+ # Python packages
114
+ RUN --mount=target=requirements.txt,source=requirements.txt \
115
+ pip install --no-cache-dir --upgrade -r requirements.txt
116
+
117
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
118
  COPY --chown=user . $HOME/app
119
 
120
  RUN chmod +x start_server.sh
121
 
 
 
122
  ENV PYTHONUNBUFFERED=1 \
123
  GRADIO_ALLOW_FLAGGING=never \
124
  GRADIO_NUM_PORTS=1 \