| # Use Python 3.10 (stable for faiss, pymupdf, transformers) | |
| FROM python:3.10-slim | |
| # Set work directory | |
| WORKDIR /app | |
| # Ensure Python doesn’t buffer logs and redirect Hugging Face cache | |
| ENV PYTHONUNBUFFERED=1 \ | |
| HF_HOME=/app/hf_cache \ | |
| TRANSFORMERS_CACHE=/app/hf_cache \ | |
| HF_DATASETS_CACHE=/app/hf_cache \ | |
| HF_MODULES_CACHE=/app/hf_cache | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirement file first (so Docker can cache pip installs) | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all app code into the container | |
| COPY . . | |
| # Expose Streamlit default port | |
| EXPOSE 8501 | |
| # Start Streamlit app | |
| CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |