Spaces:
Paused
Paused
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # System deps (minimal — no OpenCV needed without Docling) | |
| RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/* | |
| # Pre-built llama-cpp-python 0.3.21 | |
| RUN pip install --no-cache-dir \ | |
| "https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.21/llama_cpp_python-0.3.21-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy everything including PDFs | |
| COPY . . | |
| # PRE-BUILD the FAISS index (pypdf is lightweight — no OOM) | |
| RUN mkdir -p /app/cache && python build_index.py | |
| # Setup user | |
| RUN useradd -m -u 1000 user && chown -R user:user /app | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| ENV HF_HOME="/app/cache" | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| ENV GRADIO_SERVER_PORT="7860" | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |