Raja4321123 commited on
Commit
4040c95
·
verified ·
1 Parent(s): b48260b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -4
Dockerfile CHANGED
@@ -1,8 +1,27 @@
1
  FROM python:3.8
2
- COPY . /app
3
- WORKDIR /app
4
- RUN pip3 install --upgrade pip
5
- RUN pip3 install -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  EXPOSE $PORT
7
  # EXPOSE 3000
8
  CMD python main.py
 
1
  FROM python:3.8
2
+ # Set the working directory to /code
3
+ WORKDIR /code
4
+
5
+ # Copy the current directory contents into the container at /code
6
+ COPY . /code
7
+
8
+ # Install requirements.txt
9
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
10
+
11
+ # Set up a new user named "user" with user ID 1000
12
+ RUN useradd -m -u 1000 user
13
+ # Switch to the "user" user
14
+ USER user
15
+ # Set home to the user's home directory
16
+ ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
+
19
+ # Set the working directory to the user's home directory
20
+ WORKDIR $HOME/app
21
+
22
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
23
+ COPY --chown=user . $HOME/app
24
+
25
  EXPOSE $PORT
26
  # EXPOSE 3000
27
  CMD python main.py