UnisKB/deploy_artifacts/Dockerfile.mineru.corex

34 lines
2.0 KiB
Docker

# MinerU 2.7.6 / Iluvatar CoreX
FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/corex:4.4.0_torch2.7.1_vllm0.11.2_py3.10
ENV MINERU_VLLM_DEVICE=corex \
DEBIAN_FRONTEND=noninteractive \
MINERU_MODEL_SOURCE=local \
MINERU_MODEL_DIR=/models \
MINERU_TOOLS_CONFIG_JSON=/root/mineru.json \
MINERU_API_MAX_CONCURRENT_REQUESTS=1
WORKDIR /app
RUN sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g; s|http://security.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
fonts-noto-core fonts-noto-cjk fontconfig libgl1 libglib2.0-0 \
libreoffice-writer libreoffice-core libcairo2-dev pkg-config && fc-cache -fv && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY . /app
# MinerU branch pins Gradio 5.49.1 (< Pydantic 2.12) while requiring
# Pydantic >=2.12. Gradio 5.50.0 supports Pydantic 2.12 and gradio-pdf <6.
RUN python3 -c "from pathlib import Path; p=Path('pyproject.toml'); s=p.read_text(); old='gradio==5.49.1'; assert s.count(old)==1; p.write_text(s.replace(old, 'gradio==5.50.0'))"
# Resolve against the accelerator wheels already provided by the selected base image.
ARG UV_INDEX_URL
ENV UV_HTTP_TIMEOUT=30 UV_HTTP_RETRIES=2
RUN python3 scripts/accelerator_constraints.py /tmp/accelerator-constraints.txt && \
python3 -m pip install 'setuptools>=61,<81' wheel && \
PIP_INDEX_URL="${UV_INDEX_URL:-https://pypi.org/simple}" python3 -m pip install --no-build-isolation \
-c /tmp/accelerator-constraints.txt -c docker/constraints-2.7.6.txt '.[core]' 'pycairo==1.26.1' && \
python3 scripts/accelerator_constraints.py /tmp/accelerator-constraints.txt --check && \
python3 -m pip check && \
python3 -c "from mineru.version import __version__; assert __version__ == '2.7.6'" && \
chmod +x docker/entrypoint.mineru-api.sh && python3 -m pip cache purge
EXPOSE 8000
ENTRYPOINT ["/app/docker/entrypoint.mineru-api.sh"]
CMD ["mineru-api", "--host", "0.0.0.0", "--port", "8000"]