kbora commited on
Commit
d3309bd
·
1 Parent(s): da6adc0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -1,18 +1,25 @@
1
  # Use an official CUDA runtime as a parent image
2
  FROM nvidia/cuda:11.2.2-runtime-ubuntu20.04
3
 
4
- # Set the working directory in the container
5
- WORKDIR /usr/src/app
6
 
7
  # Install Python
8
  RUN apt-get update && apt-get install -y python3.8 python3-pip
9
 
 
 
 
 
 
 
 
10
  # Set the cache directories to a path with write access
11
  ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
12
  ENV MPLCONFIGDIR=/tmp/matplotlib
 
13
 
14
- # Copy the current directory contents into the container at /usr/src/app
15
- COPY . /usr/src/app
16
 
17
  # Install any needed packages specified in requirements.txt
18
  RUN pip3 install --no-cache-dir -r requirements.txt
 
1
  # Use an official CUDA runtime as a parent image
2
  FROM nvidia/cuda:11.2.2-runtime-ubuntu20.04
3
 
4
+ # Copy the current directory contents into the container at /usr/src/app
5
+ WORKDIR $HOME/app
6
 
7
  # Install Python
8
  RUN apt-get update && apt-get install -y python3.8 python3-pip
9
 
10
+ RUN useradd -m -u 1000 user
11
+ # Switch to the "user" user
12
+ USER user
13
+ # Set home to the user's home directory
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
16
+
17
  # Set the cache directories to a path with write access
18
  ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
19
  ENV MPLCONFIGDIR=/tmp/matplotlib
20
+ ENV HF_HOME=/tmp/huggingface_cache
21
 
22
+ COPY --chown=user . $HOME/app
 
23
 
24
  # Install any needed packages specified in requirements.txt
25
  RUN pip3 install --no-cache-dir -r requirements.txt