Ivan Shelonik commited on
Commit
0555843
·
1 Parent(s): 0c120b4

upd: set rights to user

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -3
Dockerfile CHANGED
@@ -8,15 +8,25 @@ WORKDIR /app
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Copy the Flask application code into the container
12
- COPY . .
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  # Expose the port on which the Flask application will run
15
  EXPOSE 5000
16
 
17
  # Set the environment variable for Flask
18
  ENV FLASK_APP=api_server.py
19
- # ENV TRANSFORMERS_CACHE=transformers_cache
20
 
21
  # Run the Flask application
22
  CMD ["flask", "run", "--host=0.0.0.0"]
 
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -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 the port on which the Flask application will run
26
  EXPOSE 5000
27
 
28
  # Set the environment variable for Flask
29
  ENV FLASK_APP=api_server.py
 
30
 
31
  # Run the Flask application
32
  CMD ["flask", "run", "--host=0.0.0.0"]