broadfield-dev commited on
Commit
63ccce0
·
verified ·
1 Parent(s): 6e26a94

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -0
Dockerfile CHANGED
@@ -1,13 +1,26 @@
1
  # Dockerfile
2
  FROM python:3.9-slim
3
 
 
 
 
4
  WORKDIR /app
5
 
 
6
  COPY requirements.txt .
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
 
9
  COPY . .
10
 
 
 
 
 
11
  EXPOSE 7860
12
 
 
 
 
 
13
  CMD ["python", "app.py"]
 
1
  # Dockerfile
2
  FROM python:3.9-slim
3
 
4
+ # Create a non-root user and group
5
+ RUN groupadd -r app && useradd -r -g app app
6
+
7
  WORKDIR /app
8
 
9
+ # Copy the requirements file and install dependencies
10
  COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy the application code
14
  COPY . .
15
 
16
+ # Create the settings directory and set permissions
17
+ RUN mkdir -p settings && chown -R app:app settings && chmod -R 775 settings
18
+
19
+ # Expose the port
20
  EXPOSE 7860
21
 
22
+ # Switch to the non-root user
23
+ USER app
24
+
25
+ # Run the Flask app
26
  CMD ["python", "app.py"]