skintest / Dockerfile
sheikh987's picture
Update Dockerfile
6e4b068 verified
# Dockerfile for Hugging Face Spaces (FastAPI)
# This special comment increases the startup timeout to 10 minutes (600s)
# It prevents the "Models are not ready" error by giving the app time to download everything.
# syntax = hf/space-builders:docker
# from:
# env:
# startup_timeout: "600"
# Use an official lightweight Python runtime as a base image
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim
# Set the port to a non-privileged one, standard for Hugging Face
ENV PORT=7860
# ↓↓↓ Add this line to control worker count and timeout ↓↓↓
ENV GUNICORN_CMD_ARGS="--workers=2 --timeout=90"
# Set the working directory inside the container
WORKDIR /app
# Copy the dependency and data files first
COPY requirements.txt .
COPY knowledge_base.json .
# Install the Python libraries from the requirements file
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the main application code
COPY main.py .
# The base image automatically finds and runs the FastAPI app from main.py