| # Hugging Face Spaces (Docker SDK) — serves the FastAPI backend on port 7860. | |
| # Build context is the repo root; only RAG_Products/ is needed. | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential && rm -rf /var/lib/apt/lists/* | |
| COPY RAG_Products/requirements.txt ./RAG_Products/requirements.txt | |
| RUN pip install --no-cache-dir -r RAG_Products/requirements.txt | |
| COPY RAG_Products ./RAG_Products | |
| # Build the FAISS index into the image so the Space starts ready to serve. | |
| RUN python -m RAG_Products.ingest | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| CMD ["sh", "-c", "uvicorn RAG_Products.api:app --host 0.0.0.0 --port ${PORT:-7860}"] | |