mineru / Dockerfile
asemxin
feat: 改用 mineru-api FastAPI 模式(更快更稳定)
34c0bd0
raw
history blame contribute delete
916 Bytes
# MinerU for HuggingFace Spaces (CPU-only)
# 基于 python:3.11-slim,使用 pipeline 后端运行
FROM python:3.11-slim
# 安装系统依赖
RUN apt-get update && apt-get install -y \
curl \
git \
fonts-noto-core \
fonts-noto-cjk \
fontconfig \
libgl1 \
libglib2.0-0 \
&& fc-cache -fv \
&& rm -rf /var/lib/apt/lists/*
# 创建非 root 用户(HF Spaces 要求)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# 安装 MinerU
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir "mineru[core]>=2.7.0"
# 下载模型到本地
RUN mineru-models-download -s huggingface -m all
# 设置环境变量
ENV MINERU_MODEL_SOURCE=local
# HF Spaces 端口
EXPOSE 7860
# 启动 FastAPI REST API(比 Gradio 更快更稳定)
CMD ["mineru-api", "--host", "0.0.0.0", "--port", "7860"]