[Feature]: Container image WORKDIR consistency (#33159)
Signed-off-by: SouthWest7 <am1ao@qq.com> Co-authored-by: SouthWest7 <am1ao@qq.com>
This commit is contained in:
+17
-20
@@ -25,7 +25,7 @@
|
|||||||
######################### COMMON BASE IMAGE #########################
|
######################### COMMON BASE IMAGE #########################
|
||||||
FROM ubuntu:22.04 AS base-common
|
FROM ubuntu:22.04 AS base-common
|
||||||
|
|
||||||
WORKDIR /workspace/
|
WORKDIR /workspace
|
||||||
|
|
||||||
ARG PYTHON_VERSION=3.12
|
ARG PYTHON_VERSION=3.12
|
||||||
ARG PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu"
|
ARG PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu"
|
||||||
@@ -35,7 +35,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
apt-get update -y \
|
apt-get update -y \
|
||||||
&& apt-get install -y --no-install-recommends sudo ccache git curl wget ca-certificates \
|
&& apt-get install -y --no-install-recommends sudo ccache git curl wget ca-certificates \
|
||||||
gcc-12 g++-12 libtcmalloc-minimal4 libnuma-dev ffmpeg libsm6 libxext6 libgl1 jq lsof \
|
gcc-12 g++-12 libtcmalloc-minimal4 libnuma-dev ffmpeg libsm6 libxext6 libgl1 jq lsof \
|
||||||
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12 \
|
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12 \
|
||||||
&& curl -LsSf https://astral.sh/uv/install.sh | sh
|
&& curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ ENV VLLM_CPU_AVX512VNNI=${VLLM_CPU_AVX512VNNI}
|
|||||||
ARG VLLM_CPU_AMXBF16=1
|
ARG VLLM_CPU_AMXBF16=1
|
||||||
ENV VLLM_CPU_AMXBF16=${VLLM_CPU_AMXBF16}
|
ENV VLLM_CPU_AMXBF16=${VLLM_CPU_AMXBF16}
|
||||||
|
|
||||||
WORKDIR /workspace/vllm
|
WORKDIR /vllm-workspace
|
||||||
|
|
||||||
# Copy build requirements
|
# Copy build requirements
|
||||||
COPY requirements/cpu-build.txt requirements/build.txt
|
COPY requirements/cpu-build.txt requirements/build.txt
|
||||||
@@ -123,13 +123,13 @@ RUN if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh ; fi
|
|||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
--mount=type=cache,target=/root/.cache/ccache \
|
--mount=type=cache,target=/root/.cache/ccache \
|
||||||
--mount=type=cache,target=/workspace/vllm/.deps,sharing=locked \
|
--mount=type=cache,target=/vllm-workspace/.deps,sharing=locked \
|
||||||
VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38
|
VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38
|
||||||
|
|
||||||
######################### TEST DEPS #########################
|
######################### TEST DEPS #########################
|
||||||
FROM base AS vllm-test-deps
|
FROM base AS vllm-test-deps
|
||||||
|
|
||||||
WORKDIR /workspace/vllm
|
WORKDIR /vllm-workspace
|
||||||
|
|
||||||
# Copy test requirements
|
# Copy test requirements
|
||||||
COPY requirements/test.in requirements/cpu-test.in
|
COPY requirements/test.in requirements/cpu-test.in
|
||||||
@@ -138,12 +138,12 @@ COPY requirements/test.in requirements/cpu-test.in
|
|||||||
RUN \
|
RUN \
|
||||||
sed -i '/mamba_ssm/d' requirements/cpu-test.in && \
|
sed -i '/mamba_ssm/d' requirements/cpu-test.in && \
|
||||||
remove_packages_not_supported_on_aarch64() { \
|
remove_packages_not_supported_on_aarch64() { \
|
||||||
case "$(uname -m)" in \
|
case "$(uname -m)" in \
|
||||||
aarch64|arm64) \
|
aarch64|arm64) \
|
||||||
sed -i '/decord/d' requirements/cpu-test.in; \
|
sed -i '/decord/d' requirements/cpu-test.in; \
|
||||||
sed -i '/terratorch/d' requirements/cpu-test.in; \
|
sed -i '/terratorch/d' requirements/cpu-test.in; \
|
||||||
;; \
|
;; \
|
||||||
esac; \
|
esac; \
|
||||||
}; \
|
}; \
|
||||||
remove_packages_not_supported_on_aarch64 && \
|
remove_packages_not_supported_on_aarch64 && \
|
||||||
sed -i 's/^torch==.*/torch==2.10.0/g' requirements/cpu-test.in && \
|
sed -i 's/^torch==.*/torch==2.10.0/g' requirements/cpu-test.in && \
|
||||||
@@ -157,7 +157,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||||||
######################### DEV IMAGE #########################
|
######################### DEV IMAGE #########################
|
||||||
FROM vllm-build AS vllm-dev
|
FROM vllm-build AS vllm-dev
|
||||||
|
|
||||||
WORKDIR /workspace/vllm
|
WORKDIR /vllm-workspace
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
@@ -174,7 +174,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||||||
--mount=type=bind,source=.git,target=.git \
|
--mount=type=bind,source=.git,target=.git \
|
||||||
VLLM_TARGET_DEVICE=cpu python3 setup.py develop
|
VLLM_TARGET_DEVICE=cpu python3 setup.py develop
|
||||||
|
|
||||||
COPY --from=vllm-test-deps /workspace/vllm/requirements/cpu-test.txt requirements/test.txt
|
COPY --from=vllm-test-deps /vllm-workspace/requirements/cpu-test.txt requirements/test.txt
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
uv pip install -r requirements/dev.txt && \
|
uv pip install -r requirements/dev.txt && \
|
||||||
@@ -185,10 +185,10 @@ ENTRYPOINT ["bash"]
|
|||||||
######################### TEST IMAGE #########################
|
######################### TEST IMAGE #########################
|
||||||
FROM vllm-test-deps AS vllm-test
|
FROM vllm-test-deps AS vllm-test
|
||||||
|
|
||||||
WORKDIR /workspace/
|
WORKDIR /vllm-workspace
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
--mount=type=bind,from=vllm-build,src=/workspace/vllm/dist,target=dist \
|
--mount=type=bind,from=vllm-build,src=/vllm-workspace/dist,target=dist \
|
||||||
uv pip install dist/*.whl
|
uv pip install dist/*.whl
|
||||||
|
|
||||||
ADD ./tests/ ./tests/
|
ADD ./tests/ ./tests/
|
||||||
@@ -197,9 +197,6 @@ ADD ./benchmarks/ ./benchmarks/
|
|||||||
ADD ./vllm/collect_env.py .
|
ADD ./vllm/collect_env.py .
|
||||||
ADD ./.buildkite/ ./.buildkite/
|
ADD ./.buildkite/ ./.buildkite/
|
||||||
|
|
||||||
# Create symlink for vllm-workspace to maintain CI compatibility
|
|
||||||
RUN ln -sf /workspace /vllm-workspace
|
|
||||||
|
|
||||||
# install development dependencies (for testing)
|
# install development dependencies (for testing)
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
uv pip install -e tests/vllm_test_utils
|
uv pip install -e tests/vllm_test_utils
|
||||||
@@ -207,11 +204,11 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||||||
######################### RELEASE IMAGE #########################
|
######################### RELEASE IMAGE #########################
|
||||||
FROM base AS vllm-openai
|
FROM base AS vllm-openai
|
||||||
|
|
||||||
WORKDIR /workspace/
|
WORKDIR /vllm-workspace
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
--mount=type=cache,target=/root/.cache/ccache \
|
--mount=type=cache,target=/root/.cache/ccache \
|
||||||
--mount=type=bind,from=vllm-build,src=/workspace/vllm/dist,target=dist \
|
--mount=type=bind,from=vllm-build,src=/vllm-workspace/dist,target=dist \
|
||||||
uv pip install dist/*.whl
|
uv pip install dist/*.whl
|
||||||
|
|
||||||
# Add labels to document build configuration
|
# Add labels to document build configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user