diff --git a/.github/workflows/buildkit-dockerfile-test.yaml b/.github/workflows/buildkit-dockerfile-test.yaml new file mode 100644 index 000000000..973c38730 --- /dev/null +++ b/.github/workflows/buildkit-dockerfile-test.yaml @@ -0,0 +1,86 @@ +name: buildkit-dockerfile-test + +on: + pull_request: + paths: + - '.github/workflows/buildkit-dockerfile-test.yaml' + - 'Dockerfile*' + workflow_dispatch: + +jobs: + build-test: + name: "${{ matrix.dockerfile }} (${{ matrix.runner_info.arch }})" + runs-on: ${{ matrix.runner_info.runner }} + container: + image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:9.0.0-a3-ubuntu22.04-py3.12 + + strategy: + fail-fast: false + matrix: + dockerfile: + - Dockerfile + - Dockerfile.310p + - Dockerfile.310p.openEuler + - Dockerfile.a3 + - Dockerfile.a3.openEuler + - Dockerfile.test + runner_info: + - {runner: linux-aarch64-cpu-4-buildkit-gy006, arch: arm64} + - {runner: linux-amd64-cpu-4-buildkit-gy006, arch: amd64} + + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Determine SOC_VERSION + id: vars + run: | + case "${{ matrix.dockerfile }}" in + Dockerfile|Dockerfile.openEuler) + echo "soc_version=ascend910b1" >> $GITHUB_OUTPUT + ;; + Dockerfile.a3|Dockerfile.a3.openEuler) + echo "soc_version=ascend910_9391" >> $GITHUB_OUTPUT + ;; + Dockerfile.a5|Dockerfile.a5.openEuler) + echo "soc_version=ascend950dt_9582" >> $GITHUB_OUTPUT + ;; + Dockerfile.310p|Dockerfile.310p.openEuler) + echo "soc_version=ascend310p1" >> $GITHUB_OUTPUT + ;; + esac + + - name: Verify buildctl environment + run: | + echo "BUILDKITD_ADDR=$BUILDKITD_ADDR" + test -n "$BUILDKITD_ADDR" || (echo "ERROR: BUILDKITD_ADDR not set" && exit 1) + test -f "${DOCKER_CONFIG}/ca.pem" || (echo "ERROR: ca.pem not found" && exit 1) + test -f "${DOCKER_CONFIG}/cert.pem" || (echo "ERROR: cert.pem not found" && exit 1) + test -f "${DOCKER_CONFIG}/key.pem" || (echo "ERROR: key.pem not found" && exit 1) + buildctl --version + + - name: Build image with buildctl + run: | + buildctl \ + --addr="${BUILDKITD_ADDR}" \ + --tlscacert="${DOCKER_CONFIG}/ca.pem" \ + --tlscert="${DOCKER_CONFIG}/cert.pem" \ + --tlskey="${DOCKER_CONFIG}/key.pem" \ + build \ + --progress=plain \ + --frontend dockerfile.v0 \ + --local context=. \ + --local dockerfile=. \ + --opt filename=${{ matrix.dockerfile }} \ + --opt build-arg:APTMIRROR=http://cache-service.nginx-pypi-cache.svc.cluster.local:8081 \ + --opt build-arg:PIP_INDEX_URL=http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple \ + --opt build-arg:VLLM_ASCEND_IMAGE=swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/vllm-ascend/vllm-ascend-ci \ + --opt build-arg:SOC_VERSION=${{ steps.vars.outputs.soc_version }} \ + --opt build-arg:COMPILE_CUSTOM_KERNELS=0 \ + --secret id=dockerconfig,src=/home/user/.docker/config.json \ + --import-cache type=registry,ref=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/buildkit-cache:${{ matrix.dockerfile }}-${{ matrix.runner_info.arch }} \ + --export-cache type=registry,ref=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/buildkit-cache:${{ matrix.dockerfile }}-${{ matrix.runner_info.arch }},mode=max \ + --output type=image,name=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/test-buildkit:${{ matrix.dockerfile }}-${{ matrix.runner_info.arch }}-${{ github.sha }},push=true diff --git a/Dockerfile b/Dockerfile index f923a7a5f..edb918d21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,23 +17,31 @@ FROM quay.io/ascend/cann:9.0.1-910b-ubuntu22.04-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG MOONCAKE_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" +ARG APTMIRROR WORKDIR /workspace # Install clang-15 (for triton-ascend) and Mooncake ARG MOONCAKE_TAG=0.3.11.post1 -RUN apt-get update -y && \ +RUN if [ -n "$APTMIRROR" ]; then \ + sed -Ei "s@(ports|archive).ubuntu.com@${APTMIRROR#http://}@g" /etc/apt/sources.list; \ + fi && \ + apt-get update -y && \ apt-get install -y git vim wget net-tools gcc g++ cmake numactl libnuma-dev libibverbs-dev libjemalloc2 libhiredis-dev clang-15 && \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \ + python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -49,7 +57,7 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \ fi # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -62,13 +70,13 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ export VLLM_BATCH_INVARIANT=1 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \ + python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \ python3 -m pip cache purge # Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH diff --git a/Dockerfile.310p b/Dockerfile.310p index 2f97a47dd..5924de6e5 100644 --- a/Dockerfile.310p +++ b/Dockerfile.310p @@ -17,17 +17,24 @@ FROM quay.io/ascend/cann:9.1.0-beta.1-310p-ubuntu22.04-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" +ARG APTMIRROR WORKDIR /workspace -RUN apt-get update -y && \ +RUN if [ -n "$APTMIRROR" ]; then \ + sed -Ei "s@(ports|archive).ubuntu.com@${APTMIRROR#http://}@g" /etc/apt/sources.list; \ + fi && \ + apt-get update -y && \ apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake numactl libnuma-dev libjemalloc2 pciutils && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -43,7 +50,7 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \ fi # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -56,10 +63,10 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton-ascend triton && \ python3 -m pip cache purge diff --git a/Dockerfile.310p.openEuler b/Dockerfile.310p.openEuler index a7ba0336a..4cbcfb3bd 100644 --- a/Dockerfile.310p.openEuler +++ b/Dockerfile.310p.openEuler @@ -17,7 +17,9 @@ FROM quay.io/ascend/cann:9.1.0-beta.1-310p-openeuler24.03-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" WORKDIR /workspace @@ -27,6 +29,7 @@ RUN yum update -y && \ # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -42,7 +45,7 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \ fi # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -54,10 +57,10 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton-ascend triton && \ python3 -m pip cache purge diff --git a/Dockerfile.a3 b/Dockerfile.a3 index 307fbac6e..244852dcf 100644 --- a/Dockerfile.a3 +++ b/Dockerfile.a3 @@ -17,7 +17,11 @@ FROM quay.io/ascend/cann:9.0.1-a3-ubuntu22.04-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG MOONCAKE_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" +ARG APTMIRROR ENV DEBIAN_FRONTEND=noninteractive @@ -25,17 +29,21 @@ WORKDIR /workspace # Install clang-15 (for triton-ascend) and Mooncake ARG MOONCAKE_TAG=0.3.11.post1 -RUN apt-get update -y && \ +RUN if [ -n "$APTMIRROR" ]; then \ + sed -Ei "s@(ports|archive).ubuntu.com@${APTMIRROR#http://}@g" /etc/apt/sources.list; \ + fi && \ + apt-get update -y && \ apt-get install -y git vim wget net-tools gcc g++ cmake numactl libnuma-dev libibverbs-dev libjemalloc2 libhiredis-dev clang-15 && \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \ + python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -51,7 +59,7 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \ fi # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -64,13 +72,13 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ export VLLM_BATCH_INVARIANT=1 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \ + python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \ python3 -m pip cache purge # Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH diff --git a/Dockerfile.a3.openEuler b/Dockerfile.a3.openEuler index d8b2a7da3..dd5836759 100644 --- a/Dockerfile.a3.openEuler +++ b/Dockerfile.a3.openEuler @@ -17,7 +17,10 @@ FROM quay.io/ascend/cann:9.0.1-a3-openeuler24.03-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG MOONCAKE_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" WORKDIR /workspace @@ -28,11 +31,12 @@ ARG MOONCAKE_TAG=0.3.11.post1 RUN yum update -y && \ yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl numactl-devel libibverbs-devel jemalloc hiredis-devel clang patch && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \ + python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \ rm -rf /var/cache/yum/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -48,7 +52,7 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \ fi # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -60,13 +64,13 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ export VLLM_BATCH_INVARIANT=1 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \ + python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \ python3 -m pip cache purge RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc diff --git a/Dockerfile.a5 b/Dockerfile.a5 index 3b1bcb9fa..a736556ec 100644 --- a/Dockerfile.a5 +++ b/Dockerfile.a5 @@ -17,7 +17,11 @@ FROM quay.io/ascend/cann:9.0.1-950-ubuntu22.04-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG MOONCAKE_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" +ARG APTMIRROR ENV DEBIAN_FRONTEND=noninteractive @@ -25,17 +29,21 @@ WORKDIR /workspace # Install clang-15 (for triton-ascend) and Mooncake ARG MOONCAKE_TAG=0.3.11.post1 -RUN apt-get update -y && \ +RUN if [ -n "$APTMIRROR" ]; then \ + sed -Ei "s@(ports|archive).ubuntu.com@${APTMIRROR#http://}@g" /etc/apt/sources.list; \ + fi && \ + apt-get update -y && \ apt-get install -y git vim wget net-tools gcc g++ cmake numactl libnuma-dev libibverbs-dev libjemalloc2 libhiredis-dev clang-15 && \ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \ update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \ + python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \ rm -rf /var/cache/apt/* && \ rm -rf /var/lib/apt/lists/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -44,7 +52,7 @@ ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.25.1 RUN git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -57,12 +65,12 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \ + python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \ python3 -m pip cache purge # Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH diff --git a/Dockerfile.a5.openEuler b/Dockerfile.a5.openEuler index 73cd94214..246b373c7 100644 --- a/Dockerfile.a5.openEuler +++ b/Dockerfile.a5.openEuler @@ -17,7 +17,10 @@ FROM quay.io/ascend/cann:9.0.1-950-openeuler24.03-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG MOONCAKE_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" WORKDIR /workspace @@ -28,11 +31,12 @@ ARG MOONCAKE_TAG=0.3.11.post1 RUN yum update -y && \ yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl numactl-devel libibverbs-devel jemalloc hiredis-devel clang patch && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \ + python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \ rm -rf /var/cache/yum/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -41,7 +45,7 @@ ARG VLLM_REPO=https://github.com/vllm-project/vllm.git ARG VLLM_TAG=v0.25.1 RUN git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -53,12 +57,12 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \ + python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \ python3 -m pip cache purge RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index 25c1f1fe7..999be8af3 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -17,7 +17,10 @@ FROM quay.io/ascend/cann:9.0.1-910b-openeuler24.03-py3.12 -ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +ARG PIP_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG MOONCAKE_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple" +ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" +ARG PYTORCH_INDEX_URL="http://cache-service.nginx-pypi-cache.svc.cluster.local/whl/cpu" WORKDIR /workspace @@ -28,11 +31,12 @@ ARG MOONCAKE_TAG=0.3.11.post1 RUN yum update -y && \ yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl numactl-devel libibverbs-devel jemalloc hiredis-devel clang patch && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ - python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \ + python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \ rm -rf /var/cache/yum/* # Install modelscope (for fast download) and ray (for multinode) RUN pip config set global.index-url ${PIP_INDEX_URL} && \ + pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local && \ python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \ python3 -m pip cache purge @@ -48,7 +52,7 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \ fi # In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it. -RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \ +RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton && \ python3 -m pip cache purge @@ -60,13 +64,13 @@ ENV SOC_VERSION=$SOC_VERSION \ OMP_NUM_THREADS=1 COPY . /vllm-workspace/vllm-ascend/ -RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \ +RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \ export VLLM_BATCH_INVARIANT=1 && \ source /usr/local/Ascend/ascend-toolkit/set_env.sh && \ source /usr/local/Ascend/nnal/atb/set_env.sh && \ - python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ + python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index ${PYTORCH_INDEX_URL} && \ python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \ + python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \ python3 -m pip cache purge RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc