Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/buildkit-dockerfile-test.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
17 changes: 12 additions & 5 deletions Dockerfile.310p
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
11 changes: 7 additions & 4 deletions Dockerfile.310p.openEuler
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
22 changes: 15 additions & 7 deletions Dockerfile.a3
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,33 @@

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

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

Expand All @@ -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

Expand All @@ -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
Expand Down
16 changes: 10 additions & 6 deletions Dockerfile.a3.openEuler
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
Loading
Loading