Skip to content

Commit 1673933

Browse files
authored
[CI] refactor dockerfile (#902)
## Purpose make the dockerfile support production usage, it can install from source or from built package. ## Modifications add build script, build package first in dockerfile, then install from the built package ## Test validate through PR gate, also add mindie and sglang compilation in PR gate pipeline
1 parent f531458 commit 1673933

23 files changed

Lines changed: 814 additions & 137 deletions

.github/workflows/pull-request.yml

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ jobs:
7373
needs: pre-check
7474
uses: ./.github/workflows/lint-and-test.yml
7575

76-
test-build-npu:
77-
timeout-minutes: 15
76+
test-build-vllm-ascend:
77+
timeout-minutes: 25
7878
runs-on: ubuntu-24.04-arm
7979
steps:
8080
- uses: actions/checkout@v4
@@ -88,16 +88,17 @@ jobs:
8888
uses: docker/build-push-action@v5
8989
with:
9090
context: .
91-
file: ./docker/Dockerfile.vllm_npu
92-
build-args: "ENABLE_SPARSE=false"
91+
file: ./docker/Dockerfile.ucm-vllm-ascend.a2-v0.17.0
92+
build-args: |
93+
PIP_INDEX_URL=https://pypi.org/simple
9394
tags: ucm-npu:latest
9495
push: false
9596
load: false
9697
cache-from: type=gha,scope=npu
9798
cache-to: type=gha,mode=max,scope=npu
9899

99-
test-build-npu-sparse:
100-
timeout-minutes: 15
100+
test-build-vllm-ascend-sparse:
101+
timeout-minutes: 25
101102
runs-on: ubuntu-24.04-arm
102103
steps:
103104
- uses: actions/checkout@v4
@@ -111,14 +112,63 @@ jobs:
111112
uses: docker/build-push-action@v5
112113
with:
113114
context: .
114-
file: ./docker/Dockerfile.vllm_npu_v0110
115-
build-args: "ENABLE_SPARSE=true"
115+
file: ./docker/Dockerfile.ucm-vllm-ascend.a2-v0.11.0
116+
build-args: |
117+
PIP_INDEX_URL=https://pypi.org/simple
116118
tags: ucm-npu-sparse:latest
117119
push: false
118120
load: false
119121
cache-from: type=gha,scope=npu
120122
cache-to: type=gha,mode=max,scope=npu
121123

124+
test-build-sglang:
125+
timeout-minutes: 25
126+
runs-on: ubuntu-24.04
127+
steps:
128+
- uses: actions/checkout@v4
129+
with:
130+
fetch-depth: 0
131+
132+
- name: Set up Docker Buildx
133+
uses: docker/setup-buildx-action@v3
134+
135+
- name: Build Image
136+
uses: docker/build-push-action@v5
137+
with:
138+
context: .
139+
file: ./docker/Dockerfile.ucm-sglang-cuda-v0.5.5
140+
build-args: |
141+
PIP_INDEX_URL=https://pypi.org/simple
142+
tags: ucm-sglang:latest
143+
push: false
144+
load: false
145+
cache-from: type=gha,scope=gpu
146+
cache-to: type=gha,mode=max,scope=gpu
147+
148+
test-build-mindie:
149+
timeout-minutes: 25
150+
runs-on: ubuntu-24.04-arm
151+
steps:
152+
- uses: actions/checkout@v4
153+
with:
154+
fetch-depth: 0
155+
156+
- name: Set up Docker Buildx
157+
uses: docker/setup-buildx-action@v3
158+
159+
- name: Build Image
160+
uses: docker/build-push-action@v5
161+
with:
162+
context: .
163+
file: ./docker/Dockerfile.ucm-mindie-ascend.a2-v2
164+
build-args: |
165+
PIP_INDEX_URL=https://pypi.org/simple
166+
tags: ucm-mindie:latest
167+
push: false
168+
load: false
169+
cache-from: type=gha,scope=npu
170+
cache-to: type=gha,mode=max,scope=npu
171+
122172
test-e2e-pc-gpu:
123173
timeout-minutes: 25
124174
runs-on: ["gpu-test-in-docker"]
@@ -159,9 +209,10 @@ jobs:
159209
sudo -E docker build --network=host \
160210
--build-arg http_proxy="${http_proxy:-}" \
161211
--build-arg https_proxy="${https_proxy:-}" \
162-
--build-arg ENABLE_SPARSE=false \
212+
--build-arg no_proxy="repo.huaweicloud.com,${no_proxy:-}" \
213+
--build-arg PIP_INDEX_URL=https://repo.huaweicloud.com/repository/pypi/simple \
163214
-t ucm-e2etest-online-inference:${{ steps.version.outputs.version }} \
164-
-f ./docker/Dockerfile.vllm_gpu ./
215+
-f ./docker/Dockerfile.ucm-vllm-cuda-v0.17.0 ./
165216
- name: Test E2E Online Inference in Docker
166217
run: |
167218
sudo chmod -R 777 /workspace/test_results/
@@ -228,9 +279,10 @@ jobs:
228279
sudo -E docker build --network=host \
229280
--build-arg http_proxy="${http_proxy:-}" \
230281
--build-arg https_proxy="${https_proxy:-}" \
231-
--build-arg ENABLE_SPARSE=true \
282+
--build-arg no_proxy="repo.huaweicloud.com,${no_proxy:-}" \
283+
--build-arg PIP_INDEX_URL=https://repo.huaweicloud.com/repository/pypi/simple \
232284
-t ucm-e2etest-gpu-sparse:${{ steps.version.outputs.version }} \
233-
-f ./docker/Dockerfile.vllm_gpu_v0110 ./
285+
-f ./docker/Dockerfile.ucm-vllm-cuda-v0.11.0 ./
234286
- name: Test E2E in Docker
235287
run: |
236288
sudo chmod -R 777 /workspace/test_results/
@@ -296,9 +348,10 @@ jobs:
296348
sudo -E docker build --network=host \
297349
--build-arg http_proxy="${http_proxy:-}" \
298350
--build-arg https_proxy="${https_proxy:-}" \
299-
--build-arg ENABLE_SPARSE=true \
351+
--build-arg no_proxy="repo.huaweicloud.com,${no_proxy:-}" \
352+
--build-arg PIP_INDEX_URL=https://repo.huaweicloud.com/repository/pypi/simple \
300353
-t ucm-e2etest-gpu-sparse:${{ steps.version.outputs.version }} \
301-
-f ./docker/Dockerfile.vllm_gpu_v0110 ./
354+
-f ./docker/Dockerfile.ucm-vllm-cuda-v0.11.0 ./
302355
- name: Test E2E in Docker
303356
run: |
304357
sudo chmod -R 777 /workspace/test_results/

docker/Dockerfile.sglang_gpu

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Set to other image if needed
2-
ARG BASE_IMAGE="swr.cn-south-1.myhuaweicloud.com/ascendhub/mindie:2.3.0-800I-A2-py311-openeuler24.03-lts"
2+
ARG IMAGE_SOURCE="swr.cn-south-1.myhuaweicloud.com/ascendhub"
3+
ARG IMAGE_NAME_VERSION="mindie:2.3.0-800I-A2-py311-openeuler24.03-lts"
34

4-
FROM ${BASE_IMAGE}
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
56

67
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
78
ARG UCM_ENABLE_MINDIE=1
89
ARG UCM_CXX11_ABI=1
10+
ARG INSTALL_MODE="source"
911

1012
WORKDIR /workspace
1113

@@ -18,7 +20,17 @@ ENV PLATFORM=ascend \
1820
UCM_ENABLE_MINDIE=${UCM_ENABLE_MINDIE} \
1921
UCM_CXX11_ABI=${UCM_CXX11_ABI}
2022

21-
RUN pip install -v -e /workspace/unified-cache-management --no-build-isolation
23+
# Build or link package
24+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
25+
pip install --no-cache-dir build cmake && \
26+
export WORKSPACE=/workspace SKIP_TAR=1 && \
27+
bash /workspace/unified-cache-management/scripts/build_mindie.sh; \
28+
else \
29+
ln -s /workspace/unified-cache-management /workspace/package; \
30+
fi
31+
32+
# Install UCM
33+
RUN pip install /workspace/package/uc_manager-*.whl
2234

2335
# Apply patch for MindIE
2436
RUN UCM_ENABLE_MINDIE=${UCM_ENABLE_MINDIE} python -c "import ucm.integration.mindie.patch.boot_patch as bp; bp.apply_patch(); print('[UCM][MindIE] patch applied (or already in place).')"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Set to other image if needed
2+
ARG IMAGE_SOURCE="lmsysorg"
3+
ARG IMAGE_NAME_VERSION="sglang:v0.5.5.post3"
4+
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
6+
7+
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
8+
ARG INSTALL_MODE="source"
9+
10+
WORKDIR /workspace
11+
12+
# Install unified-cache-management
13+
COPY . /workspace/unified-cache-management
14+
15+
RUN pip config set global.index-url ${PIP_INDEX_URL}
16+
17+
# Build or link package
18+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
19+
pip install --no-cache-dir build cmake && \
20+
export WORKSPACE=/workspace SKIP_TAR=1 && \
21+
bash /workspace/unified-cache-management/scripts/build_sglang.sh; \
22+
else \
23+
ln -s /workspace/unified-cache-management /workspace/package; \
24+
fi
25+
26+
# Install UCM
27+
RUN pip install /workspace/package/uc_manager-*.whl
28+
29+
# Apply patch for SGLang
30+
RUN cd /sgl-workspace/sglang \
31+
&& git apply /workspace/package/sglang-adapt.patch
32+
33+
ENTRYPOINT ["/bin/bash"]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Set to other image if needed
2+
ARG IMAGE_SOURCE="quay.io/ascend"
3+
ARG IMAGE_NAME_VERSION="vllm-ascend:nightly-main-openeuler"
4+
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
6+
7+
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
8+
ARG INSTALL_MODE="source"
9+
10+
WORKDIR /workspace
11+
12+
# Install unified-cache-management
13+
COPY . /workspace/unified-cache-management
14+
15+
RUN pip config set global.index-url ${PIP_INDEX_URL}
16+
17+
# Build or link package
18+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
19+
pip install --no-cache-dir build cmake && \
20+
export WORKSPACE=/workspace SKIP_TAR=1 ENABLE_SPARSE=false && \
21+
bash /workspace/unified-cache-management/scripts/build_ascend.sh; \
22+
else \
23+
ln -s /workspace/unified-cache-management /workspace/package; \
24+
fi
25+
26+
# Install UCM
27+
RUN pip install /workspace/package/uc_manager-*.whl
28+
29+
CMD ["/bin/bash"]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Set to other image if needed
2+
ARG IMAGE_SOURCE="quay.io/ascend"
3+
ARG IMAGE_NAME_VERSION="vllm-ascend:v0.11.0"
4+
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
6+
7+
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
8+
ARG INSTALL_MODE="source"
9+
10+
# Apply the UCM monkey patch for vllm & vllm_ascend
11+
ENV ENABLE_UCM_PATCH=1
12+
13+
WORKDIR /workspace
14+
15+
# Install unified-cache-management
16+
COPY . /workspace/unified-cache-management
17+
18+
RUN pip config set global.index-url ${PIP_INDEX_URL}
19+
20+
# Build or link package
21+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
22+
pip install --no-cache-dir build cmake && \
23+
export WORKSPACE=/workspace SKIP_TAR=1 && \
24+
bash /workspace/unified-cache-management/scripts/build_ascend.sh; \
25+
else \
26+
ln -s /workspace/unified-cache-management /workspace/package; \
27+
fi
28+
29+
# Install UCM
30+
RUN pip install /workspace/package/uc_manager-*.whl
31+
32+
# Install Ascend custom ops if present
33+
RUN if [ -f /workspace/package/install_ascend_ops.sh ]; then \
34+
cd /workspace/package && bash install_ascend_ops.sh; \
35+
fi
36+
37+
CMD ["/bin/bash"]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Set to other image if needed
2+
ARG IMAGE_SOURCE="quay.io/ascend"
3+
ARG IMAGE_NAME_VERSION="vllm-ascend:v0.17.0rc1"
4+
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
6+
7+
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
8+
ARG INSTALL_MODE="source"
9+
10+
WORKDIR /workspace
11+
12+
# Install unified-cache-management
13+
COPY . /workspace/unified-cache-management
14+
15+
RUN pip config set global.index-url ${PIP_INDEX_URL}
16+
17+
# Build or link package
18+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
19+
pip install --no-cache-dir build cmake && \
20+
export WORKSPACE=/workspace SKIP_TAR=1 ENABLE_SPARSE=false && \
21+
bash /workspace/unified-cache-management/scripts/build_ascend.sh; \
22+
else \
23+
ln -s /workspace/unified-cache-management /workspace/package; \
24+
fi
25+
26+
# Install UCM
27+
RUN pip install /workspace/package/uc_manager-*.whl
28+
29+
CMD ["/bin/bash"]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Set to other image if needed
2+
ARG IMAGE_SOURCE="vllm"
3+
ARG IMAGE_NAME_VERSION="vllm-openai:nightly"
4+
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
6+
7+
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
8+
ARG INSTALL_MODE="source"
9+
10+
WORKDIR /workspace
11+
12+
RUN apt-get update && \
13+
apt-get install -y --no-install-recommends git && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
# Install unified-cache-management
17+
COPY . /workspace/unified-cache-management
18+
19+
RUN pip config set global.index-url ${PIP_INDEX_URL}
20+
21+
# Build or link package
22+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
23+
pip install --no-cache-dir build cmake && \
24+
export WORKSPACE=/workspace SKIP_TAR=1 ENABLE_SPARSE=false && \
25+
bash /workspace/unified-cache-management/scripts/build_cuda.sh; \
26+
else \
27+
ln -s /workspace/unified-cache-management /workspace/package; \
28+
fi
29+
30+
# Install UCM
31+
RUN pip install /workspace/package/uc_manager-*.whl
32+
33+
ENTRYPOINT ["/bin/bash"]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Set to other image if needed
2+
ARG IMAGE_SOURCE="vllm"
3+
ARG IMAGE_NAME_VERSION="vllm-openai:v0.11.0"
4+
5+
FROM ${IMAGE_SOURCE}/${IMAGE_NAME_VERSION}
6+
7+
ARG PIP_INDEX_URL="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
8+
ARG INSTALL_MODE="source"
9+
10+
# Apply the UCM monkey patch for vllm
11+
ENV ENABLE_UCM_PATCH=1
12+
13+
WORKDIR /workspace
14+
15+
# Install unified-cache-management
16+
COPY . /workspace/unified-cache-management
17+
18+
RUN pip config set global.index-url ${PIP_INDEX_URL}
19+
20+
# Build or link package
21+
RUN if [ "${INSTALL_MODE}" != "package" ]; then \
22+
pip install --no-cache-dir build cmake && \
23+
export WORKSPACE=/workspace SKIP_TAR=1 && \
24+
bash /workspace/unified-cache-management/scripts/build_cuda.sh; \
25+
else \
26+
ln -s /workspace/unified-cache-management /workspace/package; \
27+
fi
28+
29+
# Install UCM
30+
RUN pip install /workspace/package/uc_manager-*.whl
31+
32+
ENTRYPOINT ["/bin/bash"]

0 commit comments

Comments
 (0)