Repository navigation
ci(docker): add engine-specific image build pipelines - #651
Conversation
Add separate Docker workflows and a shared Dockerfile for building engine-specific images (SGLang, vLLM, TRT-LLM). Each workflow builds from a common base image with modular install scripts. Co-authored-by: gongwei-130 <weigong28@gmail.com> Signed-off-by: Simo Lin <linsimo.mark@gmail.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Docker build infrastructure by introducing a flexible, engine-agnostic Dockerfile and corresponding installation scripts. This change allows for the creation of specialized Docker images for different large language model engines like SGLang, vLLM, and TRT-LLM, all while leveraging a shared base and modular installation logic. The primary impact is a more streamlined and maintainable process for building and deploying these engine-specific environments. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis pull request introduces a complete Docker image release pipeline for SMG with engine-specific variants (vLLM, SGLang, TRTLLM). It adds three GitHub Actions workflows that build and publish tagged images to GHCR with configurable engine repositories, a multi-stage Dockerfile for engine-specific builds, and five installation scripts for deploying different engine backends. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant GHA as GitHub Actions
participant GHRepo as GitHub Repos<br/>(SMG, Engine)
participant Docker as Docker Buildx
participant GHCR as GitHub<br/>Container Registry
User->>GHA: Trigger workflow_dispatch<br/>(base_image, engine_repo, smg_repo, tag)
GHA->>GHRepo: Checkout SMG & Engine repos
GHRepo-->>GHA: Source code
GHA->>GHCR: Authenticate (GHCR login)
GHCR-->>GHA: Auth token
GHA->>GHA: Resolve image_tag<br/>(use provided tag or derive<br/>from version strings)
GHA->>Docker: Build multi-stage image<br/>(sources → engine-specific target)<br/>with engine/SMG build args
Docker->>GHRepo: Clone engine repo (if needed)<br/>during build
GHRepo-->>Docker: Engine source code
Docker->>Docker: Execute install scripts<br/>(install-smg.sh, install-engine.sh)
Docker-->>GHA: Built image
GHA->>GHCR: Tag & push image to<br/>ghcr.io/smg:image_tag
GHCR-->>GHA: Pushed successfully
GHA->>User: Output final image name<br/>in job summary
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e31addf3d6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| git clone --depth 1 "${ENGINE_REPO}" /opt/engine-sr \ | ||
| && ( cd /opt/engine-src && ( [ "${ENGINE_COMMIT}" = "latest" ] || git checkout "${ENGINE_COMMIT}" ) ); \ |
There was a problem hiding this comment.
Clone engine into the directory used for checkout
When ENGINE_REPO is provided, this step clones into /opt/engine-sr but then immediately runs cd /opt/engine-src for checkout. In runs where users set engine repo inputs (the intended “refresh engine code” path), /opt/engine-src does not exist and the Docker build fails before any engine install step can run.
Useful? React with 👍 / 👎.
| && git clone --depth 1 "${SMG_REPO}" /tmp/smg-src \ | ||
| && ( cd /tmp/smg-src && ( [ "${SMG_COMMIT}" = "latest" ] || git checkout "${SMG_COMMIT}" ) ) |
There was a problem hiding this comment.
Fetch full history before checking out requested refs
This uses git clone --depth 1 and then conditionally checks out SMG_COMMIT; if the input is a tag/SHA that is not the default-branch tip (which the workflow inputs explicitly allow), the object is missing from a shallow clone and checkout fails. The same shallow-clone-plus-checkout pattern is also used for ENGINE_COMMIT, so non-HEAD engine refs are affected too.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Code Review
This pull request introduces a modular approach for building engine-specific Docker images using a multi-stage Dockerfile and separate installation scripts. The overall structure is good, but I've identified a critical path error in the Dockerfile that will prevent builds from succeeding. I've also included a suggestion to improve the Dockerfile's maintainability by reducing code duplication across the different build stages.
| ARG SMG_COMMIT | ||
| RUN apk add --no-cache git \ | ||
| && if [ -n "${ENGINE_REPO}" ] && [ -n "${ENGINE_COMMIT}" ]; then \ | ||
| git clone --depth 1 "${ENGINE_REPO}" /opt/engine-sr \ |
There was a problem hiding this comment.
There's a typo in the destination path of the git clone command. It's set to /opt/engine-sr, but the subsequent cd command on line 14 attempts to access /opt/engine-src. This will cause the RUN command to fail.
Please correct the destination path to /opt/engine-src.
git clone --depth 1 "${ENGINE_REPO}" /opt/engine-src \
| FROM ${BASE_IMAGE_REF} AS custom-vllm | ||
|
|
||
| ARG ENGINE_REPO | ||
| ENV SMG_DEFAULT_BACKEND=vllm | ||
| COPY --from=sources /opt/engine-src /opt/vllm-src | ||
| COPY --from=sources /tmp/smg-src /opt/smg-src | ||
| COPY --from=sources /tmp/install-vllm.sh /tmp/install-vllm.sh | ||
| COPY --from=sources /tmp/install-smg.sh /tmp/install-smg.sh | ||
| RUN bash /tmp/install-smg.sh /opt/smg-src | ||
| RUN if [ -n "${ENGINE_REPO}" ]; then bash /tmp/install-vllm.sh /opt/vllm-src; fi | ||
|
|
||
| FROM ${BASE_IMAGE_REF} AS custom-sglang | ||
|
|
||
| ARG ENGINE_REPO | ||
| ENV SMG_DEFAULT_BACKEND=sglang | ||
| COPY --from=sources /opt/engine-src /opt/sglang-src | ||
| COPY --from=sources /tmp/smg-src /opt/smg-src | ||
| COPY --from=sources /tmp/install-sglang.sh /tmp/install-sglang.sh | ||
| COPY --from=sources /tmp/install-smg.sh /tmp/install-smg.sh | ||
| RUN bash /tmp/install-smg.sh /opt/smg-src | ||
| RUN if [ -n "${ENGINE_REPO}" ]; then bash /tmp/install-sglang.sh /opt/sglang-src; fi | ||
|
|
||
| FROM ${BASE_IMAGE_REF} AS custom-trtllm | ||
|
|
||
| ARG ENGINE_REPO | ||
| ENV SMG_DEFAULT_BACKEND=trtllm | ||
| COPY --from=sources /opt/engine-src /opt/trtllm-src | ||
| COPY --from=sources /tmp/smg-src /opt/smg-src | ||
| COPY --from=sources /tmp/install-trtllm.sh /tmp/install-trtllm.sh | ||
| COPY --from=sources /tmp/install-smg.sh /tmp/install-smg.sh | ||
| RUN bash /tmp/install-smg.sh /opt/smg-src | ||
| RUN if [ -n "${ENGINE_REPO}" ]; then bash /tmp/install-trtllm.sh /opt/trtllm-src; fi | ||
|
|
||
| FROM ${BASE_IMAGE_REF} AS custom-tgl | ||
|
|
||
| ARG ENGINE_REPO | ||
| ENV SMG_DEFAULT_BACKEND=sglang | ||
| COPY --from=sources /opt/engine-src /opt/tgl-src | ||
| COPY --from=sources /tmp/smg-src /opt/smg-src | ||
| COPY --from=sources /tmp/install-tgl.sh /tmp/install-tgl.sh | ||
| COPY --from=sources /tmp/install-smg.sh /tmp/install-smg.sh | ||
| RUN bash /tmp/install-smg.sh /opt/smg-src | ||
| RUN if [ -n "${ENGINE_REPO}" ]; then bash /tmp/install-tgl.sh /opt/tgl-src; fi |
There was a problem hiding this comment.
The stages for custom-vllm, custom-sglang, custom-trtllm, and custom-tgl all repeat the same set of commands to copy and install smg. This code duplication can make the Dockerfile harder to maintain, as any changes to the smg installation process would need to be updated in four different places.
To improve this, consider introducing a common intermediate stage that handles the smg installation. The engine-specific stages could then use this common stage as their base, reducing repetition.
For example:
# ... after 'sources' stage
FROM ${BASE_IMAGE_REF} AS smg-installed
COPY --from=sources /tmp/smg-src /opt/smg-src
COPY --from=sources /tmp/install-smg.sh /tmp/install-smg.sh
RUN bash /tmp/install-smg.sh /opt/smg-src
FROM smg-installed AS custom-vllm
# ... vllm-specific installation ...
FROM smg-installed AS custom-sglang
# ... sglang-specific installation ...Signed-off-by: Simo Lin <linsimo.mark@gmail.com> Co-authored-by: gongwei-130 <weigong28@gmail.com>
Summary
Add separate Docker workflows and a shared Dockerfile for building engine-specific images (SGLang, vLLM, TRT-LLM). Each workflow builds from a common base image with modular install scripts.
Re-opened from #604 with corrected commit metadata.
Summary by CodeRabbit
Release Notes
New Features
Chores