From 8628ab9c8bdf9b01c4671e3c6caabf49afd73395 Mon Sep 17 00:00:00 2001 From: Yineng Zhang Date: Sat, 27 Jul 2024 03:54:51 +1000 Subject: [PATCH] feat: add docker workflow (#751) --- .github/workflows/docker.yml | 48 ++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 6 +++-- python/pyproject.toml | 2 +- python/sglang/version.py | 2 +- 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..ad021e6de --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,48 @@ +name: publish docker +on: + push: + branches: + - main + paths: + - "python/sglang/version.py" + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + environment: 'prod' + strategy: + matrix: + cuda_version: ['12.1.1', '12.4.1'] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push + run: | + version=$(cat python/sglang/version.py | cut -d'"' -f2) + + if [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then + cuda_tag="cu121" + elif [ "${{ matrix.cuda_version }}" = "12.4.1" ]; then + cuda_tag="cu124" + else + echo "Unsupported CUDA version" + exit 1 + fi + + tag=v${version}-${cuda_tag} + + docker build . -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.cuda_version }} -t lmsysorg/sglang:${tag} --no-cache + docker push lmsysorg/sglang:${tag} + + if [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then + docker tag lmsysorg/sglang:${tag} lmsysorg/sglang:latest + docker push lmsysorg/sglang:latest + fi diff --git a/docker/Dockerfile b/docker/Dockerfile index 042cbc858..af7982f84 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,12 +20,14 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \ && apt-get clean RUN apt-get update -y \ - && apt-get install -y python3-pip git curl sudo + && apt-get install -y git curl sudo WORKDIR /sgl-workspace RUN pip3 --no-cache-dir install --upgrade pip \ - && pip3 --no-cache-dir install "sglang[all]" \ + && git clone --depth=1 https://github.com/sgl-project/sglang.git \ + && cd sglang \ + && pip3 --no-cache-dir install -e "python[all]" \ && pip3 --no-cache-dir install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.3/ ENV DEBIAN_FRONTEND=interactive diff --git a/python/pyproject.toml b/python/pyproject.toml index 5466a355a..135fa0771 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "sglang" -version = "0.2.1" +version = "0.2.2" description = "SGLang is yet another fast serving framework for large language models and vision language models." readme = "README.md" requires-python = ">=3.8" diff --git a/python/sglang/version.py b/python/sglang/version.py index 3ced3581b..b5fdc7530 100644 --- a/python/sglang/version.py +++ b/python/sglang/version.py @@ -1 +1 @@ -__version__ = "0.2.1" +__version__ = "0.2.2"