Spaces:
Running
Running
| FROM python:3.10-slim | |
| # Install system dependencies needed for MinerU | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| git \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libgomp1 \ | |
| libglib2.0-dev \ | |
| libglfw3 \ | |
| libglfw3-dev \ | |
| libgles2-mesa-dev \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy and install requirements | |
| COPY requirements.runpod.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.runpod.txt | |
| # Install magic-pdf and dependencies | |
| RUN pip install --no-cache-dir magic-pdf[full]==0.9.0 | |
| # Create models directory | |
| RUN mkdir -p /app/models | |
| # Download MinerU models during build | |
| # This will include all models in the Docker image | |
| RUN magic-pdf download-models -p /app/models | |
| # Set environment variable for model path | |
| ENV MINERU_MODEL_PATH=/app/models | |
| # Copy handler and any custom code | |
| COPY runpod_handler.py . | |
| COPY pdf_converter_mineru.py . | |
| # Copy configuration | |
| COPY config/ ./config/ | |
| # RunPod serverless expects this | |
| CMD ["python", "-u", "runpod_handler.py"] |