add mineru docker file

This commit is contained in:
tigerenwork 2025-07-13 17:48:18 +08:00
parent 94e500c990
commit daf316bb92
2 changed files with 73 additions and 0 deletions

46
mineru/Dockerfile Normal file
View File

@ -0,0 +1,46 @@
FROM python:3.12-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libreoffice \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade pip
RUN pip install uv
# Configure uv and install mineru
ENV UV_SYSTEM_PYTHON=1
RUN uv pip install --system -U "mineru[core]"
# Copy requirements first to leverage Docker cache
# COPY requirements.txt .
# RUN pip install huggingface_hub
# RUN wget https://github.com/opendatalab/MinerU/raw/master/scripts/download_models_hf.py -O download_models_hf.py
# RUN wget https://raw.githubusercontent.com/opendatalab/MinerU/refs/heads/release-1.3.1/scripts/download_models_hf.py -O download_models_hf.py
# RUN python download_models_hf.py
RUN mineru-models-download -s modelscope -m pipeline
# RUN pip install --no-cache-dir -r requirements.txt
# RUN pip install -U magic-pdf[full]
# Copy the rest of the application
# COPY . .
# Create storage directories
# RUN mkdir -p storage/uploads storage/processed
# Expose the port the app runs on
EXPOSE 8000
# Command to run the application
CMD ["mineru-api", "--host", "0.0.0.0", "--port", "8000"]

27
mineru/docker-compose.yml Normal file
View File

@ -0,0 +1,27 @@
version: '3.8'
services:
mineru-api:
build:
context: .
dockerfile: Dockerfile
platform: linux/arm64
ports:
- "8000:8000"
volumes:
- ./storage/uploads:/app/storage/uploads
- ./storage/processed:/app/storage/processed
environment:
- PYTHONUNBUFFERED=1
- MINERU_MODEL_SOURCE=local
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
volumes:
uploads:
processed: