Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +8 -2
Dockerfile
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy the current directory contents into the container at /app
|
| 8 |
-
COPY . /app
|
| 9 |
|
| 10 |
# Install any needed packages specified in requirements.txt
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
@@ -17,5 +20,8 @@ EXPOSE 8080
|
|
| 17 |
ENV FLASK_RUN_HOST=0.0.0.0
|
| 18 |
ENV FLASK_APP=wltv_server.py
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
# Run the Flask app on port 8080
|
| 21 |
CMD ["flask", "run", "--port", "8080"]
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Create a new user with UID 1000
|
| 5 |
+
RUN useradd -m -u 1000 appuser
|
| 6 |
+
|
| 7 |
+
# Set the working directory to /app
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
# Copy the current directory contents into the container at /app
|
| 11 |
+
COPY --chown=appuser:appuser . /app
|
| 12 |
|
| 13 |
# Install any needed packages specified in requirements.txt
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 20 |
ENV FLASK_RUN_HOST=0.0.0.0
|
| 21 |
ENV FLASK_APP=wltv_server.py
|
| 22 |
|
| 23 |
+
# Switch to the non-root user
|
| 24 |
+
USER appuser
|
| 25 |
+
|
| 26 |
# Run the Flask app on port 8080
|
| 27 |
CMD ["flask", "run", "--port", "8080"]
|