DevClivora commited on
Commit
0217b8b
·
verified ·
1 Parent(s): a57c24b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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.13-slim
6
 
7
  # 2. Set the working directory inside the container.
8
  WORKDIR /code
9
 
10
- # 3. Set environment variables.
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 Flask's built-in server for debugging.
31
- # The FLASK_APP environment variable set above will ensure this command finds the right file.
32
- CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
 
 
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"]