Skip to content

Commit c257a8b

Browse files
feat(dockerfile): add ARG defaults for local+CI builds
- Add ARG definitions: MOONCAKE_INDEX_URL, PYTORCH_INDEX_URL, ASCEND_INDEX_URL - Add PIP_TRUSTED_HOST, GIT_PROXY (empty defaults for local builds) - Replace hardcoded URLs with ARG references - vLLM install: remove --extra-index pytorch.org - vllm-ascend install: --extra-index → --find-links - Local build works with public URLs, CI overrides via build-args
1 parent b2f683c commit c257a8b

8 files changed

Lines changed: 92 additions & 36 deletions

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.0.1-910b-ubuntu22.04-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
WORKDIR /workspace
2328

@@ -28,12 +33,13 @@ RUN apt-get update -y && \
2833
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \
2934
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \
3035
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
31-
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \
36+
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \
3237
rm -rf /var/cache/apt/* && \
3338
rm -rf /var/lib/apt/lists/*
3439

3540
# Install modelscope (for fast download) and ray (for multinode)
3641
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
42+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3743
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
3844
python3 -m pip cache purge
3945

@@ -46,10 +52,11 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \
4652
git -C /vllm-workspace/vllm fetch --depth 1 $VLLM_REPO "$VLLM_COMMIT" && \
4753
git -C /vllm-workspace/vllm checkout FETCH_HEAD; \
4854
else \
55+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
4956
git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \
5057
fi
5158
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
52-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
59+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
5360
python3 -m pip uninstall -y triton && \
5461
python3 -m pip cache purge
5562

@@ -62,13 +69,13 @@ ENV SOC_VERSION=$SOC_VERSION \
6269
OMP_NUM_THREADS=1
6370
COPY . /vllm-workspace/vllm-ascend/
6471

65-
RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \
72+
RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \
6673
export VLLM_BATCH_INVARIANT=1 && \
6774
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
6875
source /usr/local/Ascend/nnal/atb/set_env.sh && \
69-
python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
76+
python3 -m pip install -e /vllm-workspace/vllm-ascend/ && \
7077
python3 -m pip uninstall -y triton triton-ascend && \
71-
python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \
78+
python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \
7279
python3 -m pip cache purge
7380

7481
# Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH

Dockerfile.310p

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.1.0-beta.1-310p-ubuntu22.04-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
WORKDIR /workspace
2328

@@ -28,6 +33,7 @@ RUN apt-get update -y && \
2833

2934
# Install modelscope (for fast download) and ray (for multinode)
3035
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
36+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3137
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
3238
python3 -m pip cache purge
3339

@@ -40,10 +46,11 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \
4046
git -C /vllm-workspace/vllm fetch --depth 1 $VLLM_REPO "$VLLM_COMMIT" && \
4147
git -C /vllm-workspace/vllm checkout FETCH_HEAD; \
4248
else \
49+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
4350
git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \
4451
fi
4552
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
46-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
53+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
4754
python3 -m pip uninstall -y triton && \
4855
python3 -m pip cache purge
4956

@@ -56,10 +63,10 @@ ENV SOC_VERSION=$SOC_VERSION \
5663
OMP_NUM_THREADS=1
5764
COPY . /vllm-workspace/vllm-ascend/
5865

59-
RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \
66+
RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \
6067
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
6168
source /usr/local/Ascend/nnal/atb/set_env.sh && \
62-
python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
69+
python3 -m pip install -e /vllm-workspace/vllm-ascend/ && \
6370
python3 -m pip uninstall -y triton-ascend triton && \
6471
python3 -m pip cache purge
6572

Dockerfile.310p.openEuler

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.1.0-beta.1-310p-openeuler24.03-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
WORKDIR /workspace
2328

@@ -27,6 +32,7 @@ RUN yum update -y && \
2732

2833
# Install modelscope (for fast download) and ray (for multinode)
2934
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
35+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3036
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
3137
python3 -m pip cache purge
3238

@@ -39,10 +45,11 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \
3945
git -C /vllm-workspace/vllm fetch --depth 1 $VLLM_REPO "$VLLM_COMMIT" && \
4046
git -C /vllm-workspace/vllm checkout FETCH_HEAD; \
4147
else \
48+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
4249
git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \
4350
fi
4451
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
45-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
52+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
4653
python3 -m pip uninstall -y triton && \
4754
python3 -m pip cache purge
4855

@@ -54,10 +61,10 @@ ENV SOC_VERSION=$SOC_VERSION \
5461
OMP_NUM_THREADS=1
5562
COPY . /vllm-workspace/vllm-ascend/
5663

57-
RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \
64+
RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \
5865
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
5966
source /usr/local/Ascend/nnal/atb/set_env.sh && \
60-
python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
67+
python3 -m pip install -e /vllm-workspace/vllm-ascend/ && \
6168
python3 -m pip uninstall -y triton-ascend triton && \
6269
python3 -m pip cache purge
6370

Dockerfile.a3

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.0.1-a3-ubuntu22.04-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
ENV DEBIAN_FRONTEND=noninteractive
2328

@@ -30,12 +35,13 @@ RUN apt-get update -y && \
3035
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \
3136
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \
3237
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 && \
38+
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \
3439
rm -rf /var/cache/apt/* && \
3540
rm -rf /var/lib/apt/lists/*
3641

3742
# Install modelscope (for fast download) and ray (for multinode)
3843
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
44+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3945
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
4046
python3 -m pip cache purge
4147

@@ -48,10 +54,11 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \
4854
git -C /vllm-workspace/vllm fetch --depth 1 $VLLM_REPO "$VLLM_COMMIT" && \
4955
git -C /vllm-workspace/vllm checkout FETCH_HEAD; \
5056
else \
57+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
5158
git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \
5259
fi
5360
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
54-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
61+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
5562
python3 -m pip uninstall -y triton && \
5663
python3 -m pip cache purge
5764

@@ -64,13 +71,13 @@ ENV SOC_VERSION=$SOC_VERSION \
6471
OMP_NUM_THREADS=1
6572
COPY . /vllm-workspace/vllm-ascend/
6673

67-
RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \
74+
RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \
6875
export VLLM_BATCH_INVARIANT=1 && \
6976
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
7077
source /usr/local/Ascend/nnal/atb/set_env.sh && \
71-
python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
78+
python3 -m pip install -e /vllm-workspace/vllm-ascend/ && \
7279
python3 -m pip uninstall -y triton triton-ascend && \
73-
python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \
80+
python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \
7481
python3 -m pip cache purge
7582

7683
# Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH

Dockerfile.a3.openEuler

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.0.1-a3-openeuler24.03-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
WORKDIR /workspace
2328

@@ -28,11 +33,12 @@ ARG MOONCAKE_TAG=0.3.11.post1
2833
RUN yum update -y && \
2934
yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl numactl-devel libibverbs-devel jemalloc hiredis-devel clang patch && \
3035
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
31-
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \
36+
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \
3237
rm -rf /var/cache/yum/*
3338

3439
# Install modelscope (for fast download) and ray (for multinode)
3540
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
41+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3642
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
3743
python3 -m pip cache purge
3844

@@ -45,10 +51,11 @@ RUN if [ -n "$VLLM_COMMIT" ]; then \
4551
git -C /vllm-workspace/vllm fetch --depth 1 $VLLM_REPO "$VLLM_COMMIT" && \
4652
git -C /vllm-workspace/vllm checkout FETCH_HEAD; \
4753
else \
54+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
4855
git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm; \
4956
fi
5057
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
51-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
58+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
5259
python3 -m pip uninstall -y triton && \
5360
python3 -m pip cache purge
5461

@@ -60,13 +67,13 @@ ENV SOC_VERSION=$SOC_VERSION \
6067
OMP_NUM_THREADS=1
6168
COPY . /vllm-workspace/vllm-ascend/
6269

63-
RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \
70+
RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \
6471
export VLLM_BATCH_INVARIANT=1 && \
6572
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
6673
source /usr/local/Ascend/nnal/atb/set_env.sh && \
67-
python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
74+
python3 -m pip install -e /vllm-workspace/vllm-ascend/ && \
6875
python3 -m pip uninstall -y triton triton-ascend && \
69-
python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \
76+
python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \
7077
python3 -m pip cache purge
7178

7279
RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc

Dockerfile.a5

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.0.1-950-ubuntu22.04-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
ENV DEBIAN_FRONTEND=noninteractive
2328

@@ -30,21 +35,23 @@ RUN apt-get update -y && \
3035
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 && \
3136
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \
3237
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 && \
38+
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \
3439
rm -rf /var/cache/apt/* && \
3540
rm -rf /var/lib/apt/lists/*
3641

3742
# Install modelscope (for fast download) and ray (for multinode)
3843
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
44+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3945
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
4046
python3 -m pip cache purge
4147

4248
# Install vLLM
4349
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
4450
ARG VLLM_TAG=v0.25.1
51+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
4552
RUN 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
5865
COPY . /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/ && \
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

Dockerfile.a5.openEuler

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
FROM quay.io/ascend/cann:9.0.1-950-openeuler24.03-py3.12
1919

2020
ARG 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=""
25+
ARG GIT_PROXY=""
2126

2227
WORKDIR /workspace
2328

@@ -28,20 +33,22 @@ ARG MOONCAKE_TAG=0.3.11.post1
2833
RUN yum update -y && \
2934
yum install -y git vim wget net-tools gcc gcc-c++ make cmake numactl numactl-devel libibverbs-devel jemalloc hiredis-devel clang patch && \
3035
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
31-
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url https://mirrors.aliyun.com/pypi/web/simple && \
36+
python3 -m pip install mooncake-transfer-engine-npu==${MOONCAKE_TAG} --extra-index-url ${MOONCAKE_INDEX_URL} && \
3237
rm -rf /var/cache/yum/*
3338

3439
# Install modelscope (for fast download) and ray (for multinode)
3540
RUN pip config set global.index-url ${PIP_INDEX_URL} && \
41+
if [ -n "$PIP_TRUSTED_HOST" ]; then pip config set global.trusted-host "$PIP_TRUSTED_HOST"; fi && \
3642
python3 -m pip install modelscope 'ray>=2.47.1,<=2.48.0' 'protobuf>3.20.0' && \
3743
python3 -m pip cache purge
3844

3945
# Install vLLM
4046
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
4147
ARG VLLM_TAG=v0.25.1
48+
if [ -n "$GIT_PROXY" ]; then git config --global url."${GIT_PROXY}https://github.com/".insteadOf https://github.com/; fi && \
4249
RUN git clone --depth 1 -b $VLLM_TAG $VLLM_REPO /vllm-workspace/vllm
4350
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
44-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
51+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] && \
4552
python3 -m pip uninstall -y triton && \
4653
python3 -m pip cache purge
4754

@@ -53,12 +60,12 @@ ENV SOC_VERSION=$SOC_VERSION \
5360
OMP_NUM_THREADS=1
5461
COPY . /vllm-workspace/vllm-ascend/
5562

56-
RUN export PIP_EXTRA_INDEX_URL="https://mirrors.huaweicloud.com/ascend/repos/pypi" && \
63+
RUN export PIP_EXTRA_INDEX_URL="${ASCEND_INDEX_URL}" && \
5764
source /usr/local/Ascend/ascend-toolkit/set_env.sh && \
5865
source /usr/local/Ascend/nnal/atb/set_env.sh && \
59-
python3 -m pip install -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
66+
python3 -m pip install -e /vllm-workspace/vllm-ascend/ && \
6067
python3 -m pip uninstall -y triton triton-ascend && \
61-
python3 -m pip install triton-ascend==3.2.1 --extra-index-url https://mirrors.huaweicloud.com/ascend/repos/pypi && \
68+
python3 -m pip install triton-ascend==3.2.1 --extra-index-url ${ASCEND_INDEX_URL} && \
6269
python3 -m pip cache purge
6370

6471
RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc

0 commit comments

Comments
 (0)