sheikh987 commited on
Commit
42e72fa
·
verified ·
1 Parent(s): e025977

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -9
Dockerfile CHANGED
@@ -1,14 +1,17 @@
1
- # Dockerfile for Hugging Face Spaces (FastAPI) - CORRECTED
2
 
3
- # Use a pre-built, optimized base image from the creator of FastAPI
 
 
 
 
 
 
 
4
  FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim
5
 
6
- # --- THIS IS THE FIX ---
7
- # Set an environment variable to tell the base image
8
- # to use a different port instead of the default port 80.
9
- # Port 7860 is the standard for Hugging Face Spaces.
10
  ENV PORT=7860
11
- # --- END OF FIX ---
12
 
13
  # Set the working directory inside the container
14
  WORKDIR /app
@@ -24,5 +27,4 @@ RUN pip install --no-cache-dir --upgrade pip && \
24
  # Copy the main application code
25
  COPY main.py .
26
 
27
- # The base image will now automatically use port 7860 because of the ENV variable.
28
- # No CMD or EXPOSE instruction is needed.
 
1
+ # Dockerfile for Hugging Face Spaces (FastAPI)
2
 
3
+ # This special comment increases the startup timeout to 10 minutes (600s)
4
+ # It prevents the "Models are not ready" error by giving the app time to download everything.
5
+ # syntax = hf/space-builders:docker
6
+ # from:
7
+ # env:
8
+ # startup_timeout: "600"
9
+
10
+ # Use an official lightweight Python runtime as a base image
11
  FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim
12
 
13
+ # Set the port to a non-privileged one, standard for Hugging Face
 
 
 
14
  ENV PORT=7860
 
15
 
16
  # Set the working directory inside the container
17
  WORKDIR /app
 
27
  # Copy the main application code
28
  COPY main.py .
29
 
30
+ # The base image automatically finds and runs the FastAPI app from main.py