maca.Dockerfile 2.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. # 基础镜像配置 vLLM 或 LMDeploy 推理环境,请根据实际需要选择其中一个,要求 amd64(x86-64) CPU + metax GPU。
  2. # Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + metax GPU.
  3. FROM cr.metax-tech.com/public-ai-release/maca/vllm:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-amd64
  4. # Base image containing the LMDeploy inference environment, requiring amd64(x86-64) CPU + metax GPU.
  5. # FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/maca:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-lmdeploy0.10.2-amd64
  6. # Install libgl for opencv support & Noto fonts for Chinese characters
  7. RUN apt-get update && \
  8. apt-get install -y \
  9. fonts-noto-core \
  10. fonts-noto-cjk \
  11. fontconfig \
  12. libgl1 && \
  13. fc-cache -fv && \
  14. apt-get clean && \
  15. rm -rf /var/lib/apt/lists/*
  16. # mod torchvision to be compatible with torch 2.6
  17. RUN sed -i '3s/^Version: 0.15.1+metax3\.1\.0\.4$/Version: 0.21.0+metax3.1.0.4/' /opt/conda/lib/python3.10/site-packages/torchvision-0.15.1+metax3.1.0.4.dist-info/METADATA && \
  18. mv /opt/conda/lib/python3.10/site-packages/torchvision-0.15.1+metax3.1.0.4.dist-info /opt/conda/lib/python3.10/site-packages/torchvision-0.21.0+metax3.1.0.4.dist-info
  19. # Install mineru latest
  20. RUN /opt/conda/bin/python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
  21. /opt/conda/bin/python3 -m pip install 'mineru[core]>=2.6.5' \
  22. numpy==1.26.4 \
  23. opencv-python==4.11.0.86 \
  24. -i https://mirrors.aliyun.com/pypi/simple && \
  25. /opt/conda/bin/python3 -m pip cache purge
  26. # Download models and update the configuration file
  27. RUN /bin/bash -c "/opt/conda/bin/mineru-models-download -s modelscope -m all"
  28. # Set the entry point to activate the virtual environment and run the command line tool
  29. ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]