|
1 |
| -ARG CANN_TAG=8.2.rc1-a3-ubuntu22.04-py3.11 |
| 1 | +# Run the following command in the root directory of lmdeploy to build the image: |
| 2 | +# DOCKER_BUILDKIT=1 docker build --network=host -t lmdeploy_dlinfer:a2 -f docker/Dockerfile.ascend . |
| 3 | +ARG ASCEND_DEVICE=ascend_a2 |
| 4 | +ARG ASCEND_HUB=swr.cn-south-1.myhuaweicloud.com/ascendhub |
2 | 5 |
|
3 |
| -FROM ascendai/cann:${CANN_TAG} AS builder |
4 |
| -ARG PYTHON_VERSION=3.10 |
| 6 | +FROM ${ASCEND_HUB}/cann:8.1.rc1-910b-ubuntu22.04-py3.10 AS ascend_a2_base |
5 | 7 |
|
6 |
| -RUN --mount=type=cache,target=/root/.cache \ |
7 |
| - pip install -v uv && \ |
8 |
| - uv venv -v -p python${PYTHON_VERSION} --seed /opt/py3 |
| 8 | +FROM ${ASCEND_HUB}/cann:8.1.rc1-310p-ubuntu22.04-py3.10 AS ascend_300i_base |
9 | 9 |
|
10 |
| -ENV PATH=/opt/py3/bin:$PATH |
| 10 | +FROM ${ASCEND_DEVICE}_base AS builder |
11 | 11 | ENV LMDEPLOY_TARGET_DEVICE=ascend
|
12 |
| - |
13 |
| -COPY . /opt/lmdeploy |
14 | 12 | WORKDIR /opt/lmdeploy
|
15 |
| - |
| 13 | +COPY . . |
16 | 14 | RUN --mount=type=cache,target=/root/.cache \
|
17 |
| - pip install --upgrade pip build && \ |
| 15 | + pip config set global.index-url https://mirrors.aliyun.com/pypi/simple && \ |
| 16 | + pip config set global.trusted-host mirrors.aliyun.com && \ |
| 17 | + pip install --no-cache-dir -U pip build && \ |
18 | 18 | python -m build -w -o /wheels -v .
|
19 | 19 |
|
20 |
| -FROM ascendai/cann:${CANN_TAG} AS final |
21 |
| -COPY --from=builder /root/.local /root/.local |
22 |
| -COPY --from=builder /opt/py3 /opt/py3 |
23 |
| -ENV PATH=/opt/py3/bin:$PATH |
| 20 | +FROM ${ASCEND_DEVICE}_base AS final |
24 | 21 |
|
25 | 22 | RUN --mount=type=cache,target=/root/.cache \
|
26 |
| - --mount=type=cache,target=/wheels,from=builder,source=/wheels \ |
27 |
| - pip install /wheels/*.whl |
| 23 | + pip config set global.index-url https://mirrors.aliyun.com/pypi/simple && \ |
| 24 | + pip config set global.trusted-host mirrors.aliyun.com && \ |
| 25 | + pip install --no-cache-dir torch==2.3.1 torch-npu==2.3.1 torchvision==0.18.1 |
| 26 | + |
| 27 | +RUN --mount=type=cache,target=/wheels,from=builder,source=/wheels \ |
| 28 | + pip install --no-cache-dir /wheels/*.whl |
0 commit comments