FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ HF_HOME=/app/.cache/huggingface WORKDIR /app # System deps: pdfplumber needs poppler; sentence-transformers needs build tools RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libpoppler-cpp-dev \ poppler-utils \ && rm -rf /var/lib/apt/lists/* COPY pyproject.toml ./ RUN pip install --upgrade pip && pip install . COPY app ./app # Pre-download BGE-small so first request isn't slow RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')" || true EXPOSE 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]