Skip to content

Commit

Permalink
build(docker): update Dockerfiles for China and Huawei NPU versions
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
myhloli committed Jan 6, 2025
1 parent 36c3ad6 commit 2e1bf88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docker/china/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
22 changes: 14 additions & 8 deletions docker/huawei_npu/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 \
Expand All @@ -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 \"$@\"", "--"]

0 comments on commit 2e1bf88

Please sign in to comment.