Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -6
Dockerfile
CHANGED
|
@@ -1,18 +1,21 @@
|
|
| 1 |
# Use Python 3.9 slim image as the base
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
|
| 5 |
# Set the working directory
|
| 6 |
WORKDIR /code
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
# Switch to non-root user
|
| 11 |
-
USER myuser
|
| 12 |
|
| 13 |
# Copy and install Python dependencies
|
|
|
|
| 14 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Default command to run the application
|
| 18 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
# Use Python 3.9 slim image as the base
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
|
|
|
| 4 |
# Set the working directory
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Create a non-root user and switch to it
|
| 8 |
+
RUN groupadd -r myuser && useradd -r -g myuser myuser
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Copy and install Python dependencies
|
| 11 |
+
COPY requirements.txt /code/requirements.txt
|
| 12 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 13 |
|
| 14 |
+
# Switch to the non-root user
|
| 15 |
+
USER myuser
|
| 16 |
+
|
| 17 |
+
# Copy application code
|
| 18 |
+
COPY . /code
|
| 19 |
|
| 20 |
# Default command to run the application
|
| 21 |
+
CMD ["python", "app.py"]
|