feat: unify dockerfiles (#10705)

Co-authored-by: Yineng Zhang <me@zhyncs.com>
This commit is contained in:
ishandhanani
2025-09-23 14:23:48 +08:00
committed by GitHub
parent 9241f4fd20
commit 1c82d9db28
5 changed files with 216 additions and 62 deletions

View File

@@ -8,14 +8,19 @@ on:
workflow_dispatch:
jobs:
publish:
publish-x86:
if: github.repository == 'sgl-project/sglang'
runs-on: ubuntu-latest
environment: 'prod'
strategy:
matrix:
cuda_version: ['12.6.1', '12.9.1']
build_type: ['all']
variant:
- cuda_version: '12.6.1'
build_type: 'all'
- cuda_version: '12.8.1'
build_type: 'blackwell'
- cuda_version: '12.9.1'
build_type: 'blackwell'
runs-on: ubuntu-latest
steps:
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
@@ -34,29 +39,24 @@ jobs:
large-packages: true
swap-storage: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push
- name: Build and Push AMD64
run: |
version=$(cat python/sglang/version.py | cut -d'"' -f2)
if [ "${{ matrix.cuda_version }}" = "11.8.0" ]; then
cuda_tag="cu118"
elif [ "${{ matrix.cuda_version }}" = "12.1.1" ]; then
cuda_tag="cu121"
elif [ "${{ matrix.cuda_version }}" = "12.4.1" ]; then
cuda_tag="cu124"
elif [ "${{ matrix.cuda_version }}" = "12.5.1" ]; then
cuda_tag="cu125"
elif [ "${{ matrix.cuda_version }}" = "12.6.1" ]; then
if [ "${{ matrix.variant.cuda_version }}" = "12.6.1" ]; then
cuda_tag="cu126"
elif [ "${{ matrix.cuda_version }}" = "12.8.1" ]; then
elif [ "${{ matrix.variant.cuda_version }}" = "12.8.1" ]; then
cuda_tag="cu128"
elif [ "${{ matrix.cuda_version }}" = "12.9.1" ]; then
elif [ "${{ matrix.variant.cuda_version }}" = "12.9.1" ]; then
cuda_tag="cu129"
else
echo "Unsupported CUDA version"
@@ -65,25 +65,58 @@ jobs:
tag=v${version}-${cuda_tag}
if [ "${{ matrix.build_type }}" = "all" ]; then
if [ "${{ matrix.variant.build_type }}" = "all" ]; then
tag_suffix=""
elif [ "${{ matrix.build_type }}" = "srt" ]; then
tag_suffix="-srt"
elif [ "${{ matrix.build_type }}" = "blackwell" ]; then
elif [ "${{ matrix.variant.build_type }}" = "blackwell" ]; then
tag_suffix="-b200"
else
echo "Unsupported build type"
exit 1
fi
docker buildx build --output type=image,compression=zstd . -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.cuda_version }} --build-arg BUILD_TYPE=${{ matrix.build_type }} -t lmsysorg/sglang:${tag}${tag_suffix} --no-cache
if [ "${{ matrix.cuda_version }}" = "12.6.1" ]; then
docker tag lmsysorg/sglang:${tag}${tag_suffix} lmsysorg/sglang:latest${tag_suffix}
docker push lmsysorg/sglang:latest${tag_suffix}
if [ "${{ matrix.variant.cuda_version }}" = "12.9.1" ]; then
docker buildx build --platform linux/amd64 --push -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.variant.cuda_version }} --build-arg BUILD_TYPE=${{ matrix.variant.build_type }} -t lmsysorg/sglang:${tag}${tag_suffix} -t lmsysorg/sglang:latest --no-cache .
else
docker buildx build --platform linux/amd64 --push -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.variant.cuda_version }} --build-arg BUILD_TYPE=${{ matrix.variant.build_type }} -t lmsysorg/sglang:${tag}${tag_suffix} --no-cache .
fi
if [ "${{ matrix.cuda_version }}" = "12.9.1" ]; then
docker tag lmsysorg/sglang:${tag}${tag_suffix} lmsysorg/sglang:v${version}
docker push lmsysorg/sglang:v${version}
publish-arm64:
if: github.repository == 'sgl-project/sglang'
environment: 'prod'
strategy:
matrix:
variant:
- cuda_version: '12.9.1'
build_type: 'blackwell_aarch'
runs-on: ubuntu-22.04-arm
steps:
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push ARM64
run: |
version=$(cat python/sglang/version.py | cut -d'"' -f2)
if [ "${{ matrix.variant.cuda_version }}" = "12.9.1" ]; then
cuda_tag="cu129"
else
echo "Unsupported CUDA version"
exit 1
fi
tag=v${version}-${cuda_tag}
tag_suffix="-gb200"
docker buildx build --platform linux/arm64 --push -f docker/Dockerfile --build-arg CUDA_VERSION=${{ matrix.variant.cuda_version }} --build-arg BUILD_TYPE=${{ matrix.variant.build_type }} -t lmsysorg/sglang:${tag}${tag_suffix} --no-cache .