shrijayan commited on
Commit
512e3e3
·
1 Parent(s): 20b3ad0

Enhance Dockerfile to create app user and set proper file ownership

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -1
Dockerfile CHANGED
@@ -1,8 +1,14 @@
1
  FROM python:3.9-slim
2
 
 
 
 
3
  WORKDIR /app
4
 
5
- COPY . .
 
 
 
6
 
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
 
1
  FROM python:3.9-slim
2
 
3
+ # Create app user and directory
4
+ RUN useradd -m appuser && mkdir -p /app && chown appuser:appuser /app
5
+
6
  WORKDIR /app
7
 
8
+ # Copy files with proper ownership
9
+ COPY --chown=appuser:appuser . .
10
+
11
+ USER appuser
12
 
13
  RUN pip install --no-cache-dir -r requirements.txt
14