Karlo Pintaric commited on
Commit
c3c2fd9
1 Parent(s): c9e5fa4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -4
Dockerfile CHANGED
@@ -1,14 +1,24 @@
1
  # Use an official Python runtime as the base image
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory in the container
5
- WORKDIR /app
 
 
 
 
 
 
 
 
 
 
6
 
7
  # Copy the setup.py file and the package directory into the container
8
- COPY ./setup.py .
9
 
10
  # Install the package and its dependencies
11
- COPY ./src ./src
12
 
13
  RUN pip install --no-cache-dir .[backend] torch==1.13.1+cpu torchvision==0.14.1+cpu torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cpu
14
 
 
1
  # Use an official Python runtime as the base image
2
  FROM python:3.9-slim
3
 
4
+ # Set up a new user named "user" with user ID 1000
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Switch to the "user" user
8
+ USER user
9
+
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Set the working directory to the user's home directory
15
+ WORKDIR $HOME/app
16
 
17
  # Copy the setup.py file and the package directory into the container
18
+ COPY --chown=user ./setup.py $HOME/app
19
 
20
  # Install the package and its dependencies
21
+ COPY --chown=user ./src $HOME/app/src
22
 
23
  RUN pip install --no-cache-dir .[backend] torch==1.13.1+cpu torchvision==0.14.1+cpu torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cpu
24