|
| 1 | +# The vLLM Dockerfile is used to construct vLLM image that can be directly used |
| 2 | +# to run the OpenAI compatible server. |
| 3 | + |
| 4 | +#################### BASE BUILD IMAGE #################### |
| 5 | +FROM ubuntu:22.04 AS dev |
| 6 | + |
| 7 | +RUN apt-get update -y && \ |
| 8 | + apt-get install -y python3-pip git |
| 9 | +WORKDIR /workspace |
| 10 | + |
| 11 | +# build and install OpenVINO |
| 12 | +RUN git clone --recurse-submodules -b pytorch_module_extension https://github.com/slyalin/openvino.git |
| 13 | +RUN /workspace/openvino/install_build_dependencies.sh |
| 14 | +RUN cmake -DCPACK_GENERATOR=DEB -DENABLE_PYTHON=ON -DENABLE_PYTHON_PACKAGING=ON -DENABLE_CPPLINT=OFF \ |
| 15 | + -DENABLE_INTEL_GPU=OFF -DENABLE_TEMPLATE=OFF -DENABLE_AUTO=OFF -DENABLE_HETERO=OFF -DENABLE_AUTO_BATCH=OFF \ |
| 16 | + -DENABLE_OV_TF_FRONTEND=OFF -DENABLE_OV_ONNX_FRONTEND=OFF -DENABLE_OV_TF_LITE_FRONTEND=OFF -DENABLE_OV_PADDLE_FRONTEND=OFF \ |
| 17 | + -S /workspace/openvino -B /workspace/openvino_build |
| 18 | +RUN python3 -m pip install -r /workspace/openvino/src/bindings/python/wheel/requirements-dev.txt |
| 19 | +RUN cmake --build /workspace/openvino_build --parallel 8 |
| 20 | +RUN cmake -P /workspace/openvino_build/cmake_install.cmake |
| 21 | + |
| 22 | +# build and install OpenVINO Contrib with PagedAttention |
| 23 | +RUN git clone --branch paged-attention https://github.com/ilya-lavrenov/openvino_contrib.git |
| 24 | +RUN cmake -DCUSTOM_OPERATIONS=paged_attention -DCMAKE_INSTALL_PREFIX=/usr \ |
| 25 | + -S /workspace/openvino_contrib/modules/custom_operations/ -B /workspace/paged_attention_build/ |
| 26 | +RUN cmake --build /workspace/paged_attention_build/ --parallel 8 |
| 27 | +RUN cmake -P /workspace/openvino_build/cmake_install.cmake |
| 28 | + |
| 29 | +# Install OpenVINO tokenizers |
| 30 | +RUN PIP_PRE=1 PIP_EXTRA_INDEX_URL="https://storage.openvinotoolkit.org/simple/wheels/nightly" python3 -m pip install openvino-tokenizers |
| 31 | +#################### BASE BUILD IMAGE #################### |
| 32 | + |
| 33 | + |
| 34 | +#################### EXTENSION BUILD IMAGE #################### |
| 35 | +FROM dev AS build |
| 36 | + |
| 37 | +COPY requirements-build.txt /workspace/vllm/ |
| 38 | +COPY requirements-openvino.txt /workspace/vllm/ |
| 39 | + |
| 40 | +# install build dependencies |
| 41 | +RUN PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu" python3 -m pip install -r /workspace/vllm/requirements-build.txt |
| 42 | +# install runtime dependencies |
| 43 | +RUN PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu" python3 -m pip install -r /workspace/vllm/requirements-openvino.txt |
| 44 | + |
| 45 | +COPY vllm/ /workspace/vllm/vllm |
| 46 | +COPY setup.py /workspace/vllm/ |
| 47 | + |
| 48 | +RUN cmake -P /workspace/paged_attention_build/cmake_install.cmake |
| 49 | +RUN python3 -m pip install --no-build-isolation /workspace/vllm/ |
| 50 | +#################### EXTENSION Build IMAGE #################### |
| 51 | + |
| 52 | + |
| 53 | +#################### OPENAI API SERVER #################### |
| 54 | +# openai api server alternative |
| 55 | +FROM build AS vllm-openai |
| 56 | +# install additional dependencies for openai api server |
| 57 | +RUN --mount=type=cache,target=/root/.cache/pip \ |
| 58 | + python3 -m pip install accelerate |
| 59 | + |
| 60 | +ENTRYPOINT ["python3", "-m", "vllm.entrypoints.openai.api_server"] |
| 61 | +#################### OPENAI API SERVER #################### |
0 commit comments