feat: add docker workflow (#751)

This commit is contained in:
Yineng Zhang
2024-07-27 03:54:51 +10:00
committed by GitHub
parent 1b77670f39
commit 8628ab9c8b
4 changed files with 54 additions and 4 deletions

48
.github/workflows/docker.yml vendored Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -1 +1 @@
__version__ = "0.2.1"
__version__ = "0.2.2"