Update Dockerfile
Browse files- Dockerfile +0 -13
Dockerfile
CHANGED
@@ -1,33 +1,20 @@
|
|
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 |
-
# ↓↓↓ Add this line to control worker count and timeout ↓↓↓
|
17 |
ENV GUNICORN_CMD_ARGS="--workers=2 --timeout=90"
|
18 |
|
19 |
-
# Set the working directory inside the container
|
20 |
WORKDIR /app
|
21 |
|
22 |
-
# Copy the dependency and data files first
|
23 |
COPY requirements.txt .
|
24 |
COPY knowledge_base.json .
|
25 |
|
26 |
-
# Install the Python libraries from the requirements file
|
27 |
RUN pip install --no-cache-dir --upgrade pip && \
|
28 |
pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
-
# Copy the main application code
|
31 |
COPY main.py .
|
32 |
-
|
33 |
-
# The base image automatically finds and runs the FastAPI app from main.py
|
|
|
1 |
# Dockerfile for Hugging Face Spaces (FastAPI)
|
|
|
|
|
|
|
2 |
# syntax = hf/space-builders:docker
|
3 |
# from:
|
4 |
# env:
|
5 |
# startup_timeout: "600"
|
6 |
|
|
|
7 |
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim
|
8 |
|
|
|
9 |
ENV PORT=7860
|
|
|
|
|
10 |
ENV GUNICORN_CMD_ARGS="--workers=2 --timeout=90"
|
11 |
|
|
|
12 |
WORKDIR /app
|
13 |
|
|
|
14 |
COPY requirements.txt .
|
15 |
COPY knowledge_base.json .
|
16 |
|
|
|
17 |
RUN pip install --no-cache-dir --upgrade pip && \
|
18 |
pip install --no-cache-dir -r requirements.txt
|
19 |
|
|
|
20 |
COPY main.py .
|
|
|
|