# 1. Use an official Python base image # We use 3.11 because 3.14 is too experimental for some libraries in a container FROM python:3.11-slim # 2. Set the working directory inside the container WORKDIR /app # 3. Install system dependencies (needed for some Python packages) RUN apt-get update && apt-get install -y \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # 4. Copy your requirements file first # (This helps Docker cache your layers for faster builds) COPY requirements.txt . # 5. Install the Python dependencies RUN pip install --no-cache-dir -r requirements.txt # 6. Copy the rest of your project files into the container COPY . . # 7. Hugging Face Spaces require port 7860 EXPOSE 7860 # 8. The command to start your FastAPI app # We use uvicorn to host the app.py file CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]