Build and Push Development Docker Images #518
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Development Docker Images | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: "PR number to build from (leave empty to use current branch)" | |
| required: false | |
| default: "" | |
| tag: | |
| description: "Custom tag suffix (overrides pr_number in tag). E.g. 'my-test' → dev-my-test, dev-cu13-my-test, etc." | |
| required: false | |
| default: "" | |
| image_repo: | |
| description: "Docker Hub repo to push to. Use lmsysorg/sglang-staging for testing." | |
| required: false | |
| default: "lmsysorg/sglang" | |
| schedule: | |
| - cron: "0 0 * * *" | |
| concurrency: | |
| group: release-docker-dev-${{ inputs.tag || inputs.pr_number || 'nightly' }} | |
| cancel-in-progress: true | |
| jobs: | |
| prepare: | |
| if: github.repository == 'sgl-project/sglang' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| checkout_ref: ${{ steps.config.outputs.checkout_ref }} | |
| extra_build_args: ${{ steps.config.outputs.extra_build_args }} | |
| tag_config: ${{ steps.config.outputs.tag_config }} | |
| steps: | |
| - name: Compute build configuration | |
| id: config | |
| run: | | |
| # Determine checkout ref | |
| if [ -n "${{ inputs.pr_number }}" ]; then | |
| echo "checkout_ref=refs/pull/${{ inputs.pr_number }}/head" >> $GITHUB_OUTPUT | |
| else | |
| echo "checkout_ref=" >> $GITHUB_OUTPUT | |
| fi | |
| # Determine extra build args | |
| if [ "${{ github.event_name }}" = "schedule" ]; then | |
| echo "extra_build_args=--build-arg USE_LATEST_SGLANG=1 --build-arg CMAKE_BUILD_PARALLEL_LEVEL=\$(nproc)" >> $GITHUB_OUTPUT | |
| else | |
| echo "extra_build_args=--build-arg BRANCH_TYPE=local --build-arg CMAKE_BUILD_PARALLEL_LEVEL=\$(nproc)" >> $GITHUB_OUTPUT | |
| fi | |
| # Determine tag suffix | |
| SUFFIX="" | |
| if [ -n "${{ inputs.tag }}" ]; then | |
| SUFFIX="-${{ inputs.tag }}" | |
| elif [ -n "${{ inputs.pr_number }}" ]; then | |
| SUFFIX="-pr-${{ inputs.pr_number }}" | |
| fi | |
| # Build tag config. dev-cu13 / nightly-dev-cu13 are published as | |
| # aliases on the cu130 image for backwards compatibility with | |
| # consumers pinned to the pre-flip names. | |
| if [ -z "${SUFFIX}" ]; then | |
| # Nightly: include dated tags | |
| TAG_CONFIG='[{"cuda":"cu129","tags":["dev-cu12","nightly-dev-cu12-{date}-{short_sha}"]},{"cuda":"cu130","tags":["dev","dev-cu13","nightly-dev-{date}-{short_sha}","nightly-dev-cu13-{date}-{short_sha}"]}]' | |
| else | |
| TAG_CONFIG="[{\"cuda\":\"cu129\",\"tags\":[\"dev-cu12${SUFFIX}\"]},{\"cuda\":\"cu130\",\"tags\":[\"dev${SUFFIX}\",\"dev-cu13${SUFFIX}\"]}]" | |
| fi | |
| echo "tag_config=${TAG_CONFIG}" >> $GITHUB_OUTPUT | |
| build-and-publish: | |
| needs: prepare | |
| uses: ./.github/workflows/_docker-build-and-publish.yml | |
| with: | |
| docker_target: framework_final | |
| checkout_ref: ${{ needs.prepare.outputs.checkout_ref }} | |
| extra_build_args: ${{ needs.prepare.outputs.extra_build_args }} | |
| tag_config: ${{ needs.prepare.outputs.tag_config }} | |
| image_repo: ${{ inputs.image_repo || 'lmsysorg/sglang' }} | |
| secrets: inherit | |
| cleanup-nightly: | |
| needs: build-and-publish | |
| if: ${{ !inputs.tag && !inputs.pr_number }} | |
| uses: ./.github/workflows/_docker-cleanup-nightly.yml | |
| with: | |
| tag_prefixes: '["nightly-dev", "nightly-dev-cu12", "nightly-dev-cu13"]' | |
| image_repo: ${{ inputs.image_repo || 'lmsysorg/sglang' }} | |
| secrets: inherit |