LoremPizza commited on
Commit
dc55eb6
·
verified ·
1 Parent(s): 8006a78

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -2
Dockerfile CHANGED
@@ -1,11 +1,14 @@
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory in the container
 
 
 
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
@@ -17,5 +20,8 @@ EXPOSE 8080
17
  ENV FLASK_RUN_HOST=0.0.0.0
18
  ENV FLASK_APP=wltv_server.py
19
 
 
 
 
20
  # Run the Flask app on port 8080
21
  CMD ["flask", "run", "--port", "8080"]
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
+ # Create a new user with UID 1000
5
+ RUN useradd -m -u 1000 appuser
6
+
7
+ # Set the working directory to /app
8
  WORKDIR /app
9
 
10
  # Copy the current directory contents into the container at /app
11
+ COPY --chown=appuser:appuser . /app
12
 
13
  # Install any needed packages specified in requirements.txt
14
  RUN pip install --no-cache-dir -r requirements.txt
 
20
  ENV FLASK_RUN_HOST=0.0.0.0
21
  ENV FLASK_APP=wltv_server.py
22
 
23
+ # Switch to the non-root user
24
+ USER appuser
25
+
26
  # Run the Flask app on port 8080
27
  CMD ["flask", "run", "--port", "8080"]