Skip to content

Commit

Permalink
Dockerfile.ubi: get rid of --link flags for COPY operations
Browse files Browse the repository at this point in the history
not supported by openshift CI (buildah)

See containers/buildah#4325
  • Loading branch information
dtrifiro authored and z103cb committed May 9, 2024
1 parent 698088e commit 84e4805
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Dockerfile.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,58 @@ WORKDIR /usr/src/flash-attention-v2
RUN pip --verbose wheel flash-attn==${FLASH_ATTN_VERSION} \
--no-build-isolation --no-deps --no-cache-dir


## Test ########################################################################
FROM dev AS test

WORKDIR /vllm-workspace
# ADD is used to preserve directory structure
# NB: Could leak secrets from local context, the test image should not be pushed
# to a registry
ADD . /vllm-workspace/
# copy pytorch extensions separately to avoid having to rebuild
# when python code changes
COPY --from=build /workspace/vllm/*.so /vllm-workspace/vllm/
# Install flash attention (from pre-built wheel)
RUN --mount=type=bind,from=flash-attn-builder,src=/usr/src/flash-attention-v2,target=/usr/src/flash-attention-v2 \
pip install /usr/src/flash-attention-v2/*.whl --no-cache-dir
# ignore build dependencies installation because we are using pre-complied extensions
RUN rm pyproject.toml
RUN --mount=type=cache,target=/root/.cache/pip \
VLLM_USE_PRECOMPILED=1 pip install . --verbose


## Proto Compilation ###########################################################
FROM python-base AS gen-protos

RUN microdnf install -y \
make \
findutils \
&& microdnf clean all

RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=Makefile,target=Makefile \
--mount=type=bind,source=proto,target=proto \
make gen-protos

## vLLM Library Files ##########################################################
# Little extra stage to gather files and manage permissions on them without any
# duplication in the release layer due to permission changes
FROM base AS vllm

WORKDIR /vllm-staging
# COPY files from various places into a staging directory
COPY vllm vllm
COPY --from=build /workspace/vllm/*.so vllm/
COPY --from=gen-protos /workspace/vllm/entrypoints/grpc/pb vllm/entrypoints/grpc/pb

# custom COPY command to use umask to control permissions and grant permissions
# to the group
RUN umask 002 \
&& cp --recursive --no-preserve=all /vllm-staging/vllm /workspace/vllm \
# not strictly needed, but .so files typically have executable bits
&& chmod +x /workspace/vllm/*.so

## Release #####################################################################
# Note from the non-UBI Dockerfile:
# We used base cuda image because pytorch installs its own cuda libraries.
Expand Down

0 comments on commit 84e4805

Please sign in to comment.