From 2e1bf88174d421440867c7cf48cdd897dd10930d Mon Sep 17 00:00:00 2001 From: myhloli Date: Mon, 6 Jan 2025 18:07:40 +0800 Subject: [PATCH] build(docker): update Dockerfiles for China and Huawei NPU versions - Update package sources to use Aliyun mirrors for faster downloads - Upgrade pip and install Python packages in virtual environment - Add python3.10-dev package to Huawei NPU Dockerfile - Update requirements file URLs to master branch- Install specific version of torch_npu in Huawei NPU Dockerfile - Update magic-pdf installation method - Improve modelscope installation process - Optimize model download and configuration update steps --- docker/china/Dockerfile | 2 +- docker/huawei_npu/Dockerfile | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docker/china/Dockerfile b/docker/china/Dockerfile index ff83041c..0a198c90 100644 --- a/docker/china/Dockerfile +++ b/docker/china/Dockerfile @@ -29,7 +29,7 @@ RUN python3 -m venv /opt/mineru_venv # Activate the virtual environment and install necessary Python packages RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \ - pip3 install --upgrade pip && \ + pip3 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple && \ wget https://gitee.com/myhloli/MinerU/raw/master/docker/china/requirements.txt -O requirements.txt && \ pip3 install -r requirements.txt --extra-index-url https://wheels.myhloli.com -i https://mirrors.aliyun.com/pypi/simple && \ pip3 install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/" diff --git a/docker/huawei_npu/Dockerfile b/docker/huawei_npu/Dockerfile index 8589c9c0..980cfa4e 100644 --- a/docker/huawei_npu/Dockerfile +++ b/docker/huawei_npu/Dockerfile @@ -1,5 +1,7 @@ # Use the official Ubuntu base image -FROM swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-infer:24.0.RC3-ubuntu20.04 +FROM swr.cn-central-221.ovaijisuan.com/mindformers/mindformers1.2_mindspore2.3:20240722 + +USER root # Set environment variables to non-interactive to avoid prompts during installation ENV DEBIAN_FRONTEND=noninteractive @@ -14,7 +16,8 @@ RUN apt-get update && \ python3.10 \ python3.10-venv \ python3.10-distutils \ - python3-pip \ + python3.10-dev \ + python3-pip \ wget \ git \ libgl1 \ @@ -29,21 +32,24 @@ RUN python3 -m venv /opt/mineru_venv # Activate the virtual environment and install necessary Python packages RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \ - pip3 install --upgrade pip && \ - wget https://gitee.com/myhloli/MinerU/raw/dev/docker/huawei_npu/requirements.txt -O requirements.txt && \ - pip3 install -r requirements.txt --extra-index-url https://wheels.myhloli.com -i https://mirrors.aliyun.com/pypi/simple" + pip3 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple && \ + wget https://gitee.com/myhloli/MinerU/raw/master/docker/huawei_npu/requirements.txt -O requirements.txt && \ + pip3 install -r requirements.txt --extra-index-url https://wheels.myhloli.com -i https://mirrors.aliyun.com/pypi/simple && \ + wget https://gitee.com/ascend/pytorch/releases/download/v6.0.rc2-pytorch2.3.1/torch_npu-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl && \ + pip install torch_npu-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" # Copy the configuration file template and install magic-pdf latest RUN /bin/bash -c "wget https://gitee.com/myhloli/MinerU/raw/master/magic-pdf.template.json && \ cp magic-pdf.template.json /root/magic-pdf.json && \ source /opt/mineru_venv/bin/activate && \ - pip3 install git+https://gitee.com/myhloli/MinerU.git@dev" + pip3 install -U magic-pdf" # Download models and update the configuration file -RUN /bin/bash -c "pip3 install modelscope && \ +RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \ + pip3 install modelscope -i https://mirrors.aliyun.com/pypi/simple && \ wget https://gitee.com/myhloli/MinerU/raw/master/scripts/download_models.py -O download_models.py && \ python3 download_models.py && \ sed -i 's|cpu|npu|g' /root/magic-pdf.json" # Set the entry point to activate the virtual environment and run the command line tool -ENTRYPOINT ["/bin/bash", "-c", "source /opt/mineru_venv/bin/activate && exec \"$@\"", "--"] +ENTRYPOINT ["/bin/bash", "-c", "source /opt/mineru_venv/bin/activate && exec \"$@\"", "--"] \ No newline at end of file