Valentin De Matos commited on
Commit
2dad8c0
·
1 Parent(s): 6f351d2

Signed-off-by: Valentin De Matos <[email protected]>

Files changed (1) hide show
  1. Dockerfile +17 -8
Dockerfile CHANGED
@@ -1,12 +1,9 @@
1
- FROM python:3.9.16
2
-
3
- WORKDIR /code
4
 
5
- RUN mkdir -p /code
6
 
7
- RUN chmod 777 /code
8
- RUN chmod 777 /tmp
9
 
 
10
 
11
  COPY ./requirements.txt /code/requirements.txt
12
 
@@ -14,6 +11,18 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
14
 
15
  RUN cat /etc/ImageMagick-6/policy.xml | sed "s|\"none\"|\"write\|read\"|g" > /etc/ImageMagick-6/policy.xml
16
 
17
- COPY . .
 
 
 
 
 
 
18
 
19
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
1
+ CMD ["python", "app.py"]
 
 
2
 
 
3
 
4
+ FROM python:3.9
 
5
 
6
+ WORKDIR /code
7
 
8
  COPY ./requirements.txt /code/requirements.txt
9
 
 
11
 
12
  RUN cat /etc/ImageMagick-6/policy.xml | sed "s|\"none\"|\"write\|read\"|g" > /etc/ImageMagick-6/policy.xml
13
 
14
+ # Set up a new user named "user" with user ID 1000
15
+ RUN useradd -m -u 1000 user
16
+ # Switch to the "user" user
17
+ USER user
18
+ # Set home to the user's home directory
19
+ ENV HOME=/home/user \
20
+ PATH=/home/user/.local/bin:$PATH
21
 
22
+ # Set the working directory to the user's home directory
23
+ WORKDIR $HOME/app
24
+
25
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
26
+ COPY --chown=user . $HOME/app
27
+
28
+ CMD ["python", "main.py"]