gouravbhadraDev commited on
Commit
6a2d980
·
verified ·
1 Parent(s): 042861c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -3
Dockerfile CHANGED
@@ -1,12 +1,21 @@
1
  FROM python:3.10-slim
2
 
3
- WORKDIR /app
 
4
 
5
- COPY requirements.txt .
 
 
 
6
 
 
 
 
 
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
9
- COPY app.py .
 
10
 
11
  EXPOSE 7860
12
 
 
1
  FROM python:3.10-slim
2
 
3
+ # Create non-root user
4
+ RUN useradd -m -u 1000 user
5
 
6
+ # Switch to that user (applies to all following steps)
7
+ USER user
8
+ ENV HOME=/home/user \
9
+ PATH=/home/user/.local/bin:$PATH
10
 
11
+ WORKDIR /home/user/app
12
+
13
+ # Install dependencies as user
14
+ COPY --chown=user:root requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy app files
18
+ COPY --chown=user:root app.py .
19
 
20
  EXPOSE 7860
21