Spaces:
Sleeping
Sleeping
YUpdate docker file
Browse files- Dockerfile +15 -16
Dockerfile
CHANGED
|
@@ -1,23 +1,22 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM python:3.9
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
ENV PYTHONUNBUFFERED 1
|
| 6 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
-
|
| 8 |
-
# Create a non-root user
|
| 9 |
RUN useradd -m -u 1000 user
|
|
|
|
| 10 |
|
| 11 |
-
#
|
|
|
|
|
|
|
|
|
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
COPY --chown=user
|
| 16 |
-
|
| 17 |
-
RUN pip install --no-cache-dir --upgrade -r /app/req.txt
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
COPY --chown=user
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
CMD ["gunicorn", "
|
|
|
|
| 1 |
+
# Starting from an official Python image
|
| 2 |
+
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Creating a non-root user for security
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
|
| 8 |
+
# Ensuring user's local bin is on PATH
|
| 9 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 10 |
+
|
| 11 |
+
# Setting working directory inside container
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Installing Python dependencies
|
| 15 |
+
COPY --chown=user ./req.txt req.txt
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade -r req.txt
|
|
|
|
| 17 |
|
| 18 |
+
# Copying the rest of your app code
|
| 19 |
+
COPY --chown=user . /app
|
| 20 |
|
| 21 |
+
# Starting the Flask app using gunicorn
|
| 22 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app","--timeout","120","--workers","1"]
|