Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +12 -3
Dockerfile
CHANGED
|
@@ -1,11 +1,20 @@
|
|
| 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 |
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"]
|