DevClivora commited on
Commit
573812a
·
verified ·
1 Parent(s): 0737003

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -6
Dockerfile CHANGED
@@ -2,15 +2,18 @@
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
- # --- FIX ---
11
- # 3. Set the HF_HOME environment variable to a writable directory.
12
- # This prevents the "Permission denied: '/.cache'" error.
13
  ENV HF_HOME="/tmp/.cache/huggingface"
 
 
 
 
14
 
15
  # 4. Copy the requirements file into the working directory.
16
  COPY ./requirements.txt /code/requirements.txt
@@ -24,5 +27,6 @@ COPY ./ /code/
24
  # 7. Expose the port that the application will run on.
25
  EXPOSE 7860
26
 
27
- # 8. Define the command to run the application using Gunicorn.
28
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
 
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 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
  # 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"]