# Use Python 3.11 slim base image FROM python:3.11-slim # Avoid interactive prompts ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # Install system packages RUN apt-get update && apt-get install -y \ git \ curl \ build-essential \ ffmpeg \ libsm6 \ libxext6 \ libgl1-mesa-glx \ poppler-utils \ tesseract-ocr \ && rm -rf /var/lib/apt/lists/* # Install git-lfs (olmocr uses some models hosted on LFS) RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \ apt-get install -y git-lfs && git lfs install # Set workdir WORKDIR /app # Copy requirements and install Python packages COPY requirements.txt . RUN pip install -r requirements.txt # Install frpc binary for Gradio tunnels RUN curl -L https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 \ -o /usr/local/lib/python3.11/site-packages/gradio/frpc_linux_amd64_v0.2 && \ chmod +x /usr/local/lib/python3.11/site-packages/gradio/frpc_linux_amd64_v0.2 # Copy rest of the application COPY . . # Expose port (Gradio runs on 7860 by default, but HF Spaces handles routing) EXPOSE 7860 # Run the Gradio app CMD ["python", "app.py"] ENV XDG_CACHE_HOME=/tmp/xdg_cache ENV MPLCONFIGDIR=/tmp/mplcache