saadkhi commited on
Commit
5b57a58
·
verified ·
1 Parent(s): 0e261b3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -3
Dockerfile CHANGED
@@ -1,11 +1,20 @@
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
  CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Set up a non-root user as recommended by Hugging Face
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
+ WORKDIR /app
9
 
10
+ # Copy requirement files and install
11
+ COPY --chown=user requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Copy everything else with correct ownership
15
+ COPY --chown=user . .
16
+
17
+ # Explicitly expose port 7860
18
+ EXPOSE 7860
19
 
20
  CMD ["python", "app.py"]