FROM python:3.10-slim # Prevents Python from writing .pyc files & enables unbuffered logs ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /code # System deps (optional but handy) RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates && \ rm -rf /var/lib/apt/lists/* # Python deps COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # App code COPY . . # HF Spaces will set OPENAI_API_KEY as a Secret in the environment EXPOSE 7860 # Start FastAPI with uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]