File size: 1,130 Bytes
4112422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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"]