1818FROM quay.io/ascend/cann:9.0.1-950-ubuntu22.04-py3.12
1919
2020ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
21+ ARG MOONCAKE_INDEX_URL="https://mirrors.aliyun.com/pypi/web/simple"
22+ ARG PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cpu"
23+ ARG ASCEND_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi"
24+ ARG PIP_TRUSTED_HOST=""
2125
2226ENV DEBIAN_FRONTEND=noninteractive
2327
@@ -30,21 +34,24 @@ RUN apt-get update -y && \
3034 update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \
3135 update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \
3236 source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
33- python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \
37+ python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \
3438 rm -rf /var/cache/apt/* && \
3539 rm -rf /var/lib/apt/lists/*
3640
3741# Install modelscope (for fast download) and ray (for multinode)
3842RUN pip config set global.index-url ${PIP_INDEX_URL} && \
43+ if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3944 python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
4045 python3 -m pip cache purge
4146
4247# Install vLLM
4348ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
4449ARG VLLM_TAG=v0.25.1
45- RUN git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm
50+ ARG GIT_PROXY=""
51+ RUN if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
52+ git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm
4653# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
47- RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
54+ RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
4855 python3 -m pip uninstall -y triton && \
4956 python3 -m pip cache purge
5057
@@ -57,12 +64,12 @@ ENV SOC_VERSION=$SOC_VERSION \
5764 OMP_NUM_THREADS=1
5865COPY . /vllm-workspace/vllm-ascend/
5966
60- RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi " && \
67+ RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL} " && \
6168 source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
6269 source /usr/local/Ascend/nnal/atb/set_env.sh && \
63- python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu / && \
70+ python3 -m pip install -e /vllm-workspace/vllm-ascend/ --find-links ${PYTORCH_INDEX_URL}/torch/ --find-links ${PYTORCH_INDEX_URL}/torchvision / && \
6471 python3 -m pip uninstall -y triton triton-ascend && \
65- python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \
72+ python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \
6673 python3 -m pip cache purge
6774
6875# Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH
0 commit comments