FROM python:3.11-slim # Keep Python output unbuffered and avoid .pyc files in containers. ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PIP_NO_CACHE_DIR=1 # Optional Hugging Face cache location inside the container. ENV HF_HOME=/app/.cache/huggingface ENV TRANSFORMERS_CACHE=/app/.cache/huggingface WORKDIR /app # System libs often needed by ML wheels/runtime. RUN apt-get update && apt-get install -y --no-install-recommends \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies used by Fastapi/main.py. RUN pip install --upgrade pip && pip install \ fastapi \ "uvicorn[standard]" \ numpy \ faiss-cpu \ torch \ transformers \ huggingface_hub \ sentencepiece \ InstructorEmbedding \ langchain-core \ sentence-transformers \ accelerate # Copy the whole repo so Fastapi app can resolve vector_db.index/chunks.pkl # from /app, /app/Fastapi, or /app/RAG_pipeline. COPY . /app EXPOSE 8000 # Run FastAPI app. CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]