Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docker] Add docker file for vllm #101

Merged
merged 4 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ jobs:
nvidia-docker run --rm -t --net host --ipc host \
-v ${PWD}:/workspace \
-w /workspace \
registry.cn-beijing.aliyuncs.com/llumnix/llumnix-dev:20240909_action_678a439 \
registry.cn-beijing.aliyuncs.com/llumnix/llumnix-dev:20250213_image_65d0368 \
bash -c "pip install -e .[vllm] > /dev/null && make lint"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
init:
@git submodule update --init --recursive

.PHONY: install
install:
.PHONY: vllm_install
vllm_install:
@pip install -e .[vllm]

.PHONY: lint
Expand Down
2 changes: 1 addition & 1 deletion docs/Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can build and install Llumnix from source:
```
git clone https://github.com/AlibabaPAI/llumnix.git
cd llumnix
make install
make vllm_install
```

The default migration backend is rayrpc. If you want to use NCCL as the migration backend, run `make cupy-cuda` to install [cupy-cuda](https://pypi.org/search/?q=cupy-cuda) manually, as it is related to the CUDA version.
Expand Down
22 changes: 22 additions & 0 deletions tools/docker/Dockerfile.vllm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM nvcr.io/nvidia/pytorch:23.10-py3

ARG BRANCH="main"
ARG COMMIT_ID="unknown"

RUN apt-get update && \
apt-get install -y bc && \
wget -O /tmp/bazel.deb "https://github.com/bazelbuild/bazel/releases/download/5.1.0/bazel_5.1.0-linux-x86_64.deb" && \
dpkg -i /tmp/bazel.deb && \
rm /tmp/bazel.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN git clone https://github.com/AlibabaPAI/llumnix.git && \
cd llumnix && \
git fetch origin ${BRANCH} && \
git checkout ${BRANCH} && \
git checkout ${COMMIT_ID} && \
make pygloo && \
make check_pylint_installed && \
make check_pytest_installed && \
make vllm_install
55 changes: 9 additions & 46 deletions tools/image_build.sh
Original file line number Diff line number Diff line change
@@ -1,55 +1,18 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Usage: $0 <NAMESPACE>"
exit 1
fi

NAMESPACE="$1"
REPO="registry.cn-beijing.aliyuncs.com/llumnix/${NAMESPACE}"
set -e

REPO="registry.cn-beijing.aliyuncs.com/llumnix/llumnix-dev"
DATE=$(date +%Y%m%d)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
COMMIT_ID=$(git rev-parse --short=7 HEAD)
TAG="${DATE}_${BRANCH}_${COMMIT_ID}"

# Get the Git user email
USER_EMAIL=$(git config user.email)

if [ -z "$USER_EMAIL" ] || [ "${#USER_EMAIL}" -le 0 ]; then
echo "Error: Git user email is not set or empty. Please set it using 'git config user.email'"
exit 1
fi

# Ask for the container ID
echo "Please enter the container ID or name you want to commit:"
read CONTAINER_ID

if ! docker inspect -f '{{.ID}}' "$CONTAINER_ID" &> /dev/null; then
echo "Error: The container '$CONTAINER_ID' does not exist."
exit 1
fi

# Display the details about the commit
echo "Preparing to commit the following container:"
echo "Container ID: $CONTAINER_ID"
echo "Image TAG: ${REPO}:${TAG}"
echo "Using Git user email: $USER_EMAIL"

# Confirm the commit action
read -p "Do you want to proceed with the commit? (y/n): " -n 1 -r
echo # move to a new line
if [[ $REPLY != "y" ]]; then
echo "Commit aborted."
exit 1
fi

# Commit the container with an optional message and author
docker commit -a "${USER_EMAIL}" "${CONTAINER_ID}" "${REPO}:${TAG}"
echo "Building docker image ${REPO}:${TAG}"

if [ $? -eq 0 ]; then
echo "Image committed successfully: ${REPO}:${TAG}"
else
echo "Image commit failed!"
exit 1
fi
export DOCKER_BUILDKIT=1
docker build . \
-f tools/docker/Dockerfile.vllm \
--build-arg BRANCH=${BRANCH} \
--build-arg COMMIT_ID=${COMMIT_ID} \
-t ${REPO}:${TAG}
4 changes: 2 additions & 2 deletions tools/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pgrep -f llumnix.entrypoints.vllm.api_server | { while read pid; do kill -9 "$pi
pgrep -f benchmark_serving.py | { while read pid; do kill -9 "$pid"; done; }

nvidia-docker run --rm -t --net host --ipc host -v ${PWD}:/workspace -v /mnt:/mnt -w /workspace \
registry.cn-beijing.aliyuncs.com/llumnix/llumnix-dev:20240909_action_678a439 \
sh -c "make install > /dev/null && make $test_mode"
registry.cn-beijing.aliyuncs.com/llumnix/llumnix-dev:20250213_image_65d0368 \
sh -c "make vllm_install > /dev/null && make $test_mode"