瀏覽代碼

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
myhloli 10 月之前
父節點
當前提交
2e1bf88174
共有 2 個文件被更改,包括 15 次插入9 次删除
  1. 1 1
      docker/china/Dockerfile
  2. 14 8
      docker/huawei_npu/Dockerfile

+ 1 - 1
docker/china/Dockerfile

@@ -29,7 +29,7 @@ RUN python3 -m venv /opt/mineru_venv
 
 
 # Activate the virtual environment and install necessary Python packages
 # Activate the virtual environment and install necessary Python packages
 RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \
 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 && \
     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 -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/"
     pip3 install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/"

+ 14 - 8
docker/huawei_npu/Dockerfile

@@ -1,5 +1,7 @@
 # Use the official Ubuntu base image
 # 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
 # Set environment variables to non-interactive to avoid prompts during installation
 ENV DEBIAN_FRONTEND=noninteractive
 ENV DEBIAN_FRONTEND=noninteractive
@@ -14,7 +16,8 @@ RUN apt-get update && \
         python3.10 \
         python3.10 \
         python3.10-venv \
         python3.10-venv \
         python3.10-distutils \
         python3.10-distutils \
-        python3-pip \
+	    python3.10-dev \
+	    python3-pip \
         wget \
         wget \
         git \
         git \
         libgl1 \
         libgl1 \
@@ -29,21 +32,24 @@ RUN python3 -m venv /opt/mineru_venv
 
 
 # Activate the virtual environment and install necessary Python packages
 # Activate the virtual environment and install necessary Python packages
 RUN /bin/bash -c "source /opt/mineru_venv/bin/activate && \
 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
 # 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 && \
 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 && \
     cp magic-pdf.template.json /root/magic-pdf.json && \
     source /opt/mineru_venv/bin/activate && \
     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
 # 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 && \
     wget https://gitee.com/myhloli/MinerU/raw/master/scripts/download_models.py -O download_models.py && \
     python3 download_models.py && \
     python3 download_models.py && \
     sed -i 's|cpu|npu|g' /root/magic-pdf.json"
     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
 # 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 \"$@\"", "--"]