Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +6 -9
Dockerfile
CHANGED
|
@@ -2,18 +2,14 @@
|
|
| 2 |
# This file tells Hugging Face Spaces how to build and run the Flask application.
|
| 3 |
|
| 4 |
# 1. Start with a standard Python 3.9 base image.
|
| 5 |
-
FROM python:3.
|
| 6 |
|
| 7 |
# 2. Set the working directory inside the container.
|
| 8 |
WORKDIR /code
|
| 9 |
|
| 10 |
-
# 3. Set environment
|
| 11 |
# This prevents the /.cache permission error.
|
| 12 |
ENV HF_HOME="/tmp/.cache/huggingface"
|
| 13 |
-
# --- FIX ---
|
| 14 |
-
# This explicitly tells Flask which file contains the application.
|
| 15 |
-
# This is a more robust way to ensure routes are found.
|
| 16 |
-
ENV FLASK_APP=app.py
|
| 17 |
|
| 18 |
# 4. Copy the requirements file into the working directory.
|
| 19 |
COPY ./requirements.txt /code/requirements.txt
|
|
@@ -27,6 +23,7 @@ COPY ./ /code/
|
|
| 27 |
# 7. Expose the port that the application will run on.
|
| 28 |
EXPOSE 7860
|
| 29 |
|
| 30 |
-
# 8. Define the command to run the application using
|
| 31 |
-
#
|
| 32 |
-
|
|
|
|
|
|
| 2 |
# This file tells Hugging Face Spaces how to build and run the Flask application.
|
| 3 |
|
| 4 |
# 1. Start with a standard Python 3.9 base image.
|
| 5 |
+
FROM python:3.9-slim
|
| 6 |
|
| 7 |
# 2. Set the working directory inside the container.
|
| 8 |
WORKDIR /code
|
| 9 |
|
| 10 |
+
# 3. Set the HF_HOME environment variable to a writable directory.
|
| 11 |
# This prevents the /.cache permission error.
|
| 12 |
ENV HF_HOME="/tmp/.cache/huggingface"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# 4. Copy the requirements file into the working directory.
|
| 15 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
| 23 |
# 7. Expose the port that the application will run on.
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
+
# 8. Define the command to run the application using Gunicorn (production standard).
|
| 27 |
+
# This is more robust than `flask run` and explicitly points to the 'app' object
|
| 28 |
+
# within the 'app.py' module, which should solve the route discovery issue.
|
| 29 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|