Abid Ali Awan commited on
Commit
e29d227
1 Parent(s): 121cefd

fixed the docker

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -3
Dockerfile CHANGED
@@ -1,11 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory
5
- WORKDIR /app
6
 
7
  # Copy the current directory contents into the container at /app
8
- COPY . /app
9
 
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
 
1
+ # Set up a new user named "user" with user ID 1000
2
+ RUN useradd -m -u 1000 user
3
+
4
+ # Switch to the "user" user
5
+ USER user
6
+
7
+ # Set home to the user's home directory
8
+ ENV HOME=/home/user \
9
+ PATH=/home/user/.local/bin:$PATH
10
+
11
+ # Set the working directory to the user's home directory
12
+ WORKDIR $HOME/app
13
+
14
  # Use an official Python runtime as a parent image
15
  FROM python:3.9-slim
16
 
 
 
17
 
18
  # Copy the current directory contents into the container at /app
19
+ COPY --chown=user . $HOME/app
20
 
21
  # Install any needed packages specified in requirements.txt
22
  RUN pip install --no-cache-dir -r requirements.txt