FROM python:3.11-slim WORKDIR /app # System deps (libgomp for ONNX Runtime, curl for health check) RUN apt-get update && apt-get install -y --no-install-recommends \ libgomp1 \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python deps first (layer cache) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the fastembed ONNX model so cold starts don't hit the network RUN python3 -c "from fastembed import TextEmbedding; list(TextEmbedding('BAAI/bge-small-en-v1.5').embed(['warmup']))" # Copy app code COPY app.py answer.py retrieval.py ./ # Copy runtime data (chroma vector store + JSONL chunks, not books) COPY data/chroma/ ./data/chroma/ COPY data/book_chunks.jsonl ./data/book_chunks.jsonl COPY data/presentation_chunks.jsonl ./data/presentation_chunks.jsonl COPY data/glp/ ./data/glp/ COPY data/pali-cannon/ ./data/pali-cannon/ # Streamlit config COPY .streamlit/ ./.streamlit/ EXPOSE 7860 HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1 CMD ["streamlit", "run", "app.py", \ "--server.port=7860", \ "--server.address=0.0.0.0", \ "--server.headless=true", \ "--browser.gatherUsageStats=false"]