# Use official lightweight Python 3.12 runtime FROM python:3.12-slim # Prevent Python from writing .pyc files and enable unbuffered logging ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PORT=7860 # Install minimal OS dependencies for PDF processing and math libraries RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application source code COPY . . # Ensure storage directories exist RUN mkdir -p data/uploads data/processed data/vectorstore # Expose Hugging Face Space port EXPOSE 7860 # Run Gradio application CMD ["python", "app.py"]