Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +12 -3
Dockerfile
CHANGED
@@ -1,12 +1,21 @@
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
|
|
7 |
RUN pip install --no-cache-dir -r requirements.txt
|
8 |
|
9 |
-
|
|
|
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 |
|