Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
FROM python:3.9
|
| 2 |
|
|
|
|
| 3 |
RUN useradd -m -u 1000 user
|
| 4 |
USER user
|
| 5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
|
|
|
| 9 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 11 |
|
|
|
|
| 12 |
COPY --chown=user . /app
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
# Run with Gunicorn
|
| 21 |
-
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "flask_app:app"]
|
|
|
|
| 1 |
FROM python:3.9
|
| 2 |
|
| 3 |
+
# Create a non-root user
|
| 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 and install requirements first for caching
|
| 11 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 12 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 13 |
|
| 14 |
+
# Copy the rest of the application
|
| 15 |
COPY --chown=user . /app
|
| 16 |
|
| 17 |
+
# Set the Flask app entry point for the 'flask run' command
|
| 18 |
+
ENV FLASK_APP=flask_app.py
|
| 19 |
|
| 20 |
+
# Run the Flask app on port 7860 (common for HF Spaces) and bind to all interfaces
|
| 21 |
+
CMD ["python", "-m", "flask", "run", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|