Skip to content

update docker build#1872

Merged
ovowei merged 1 commit intomainfrom
fix-docker-build
Feb 28, 2026
Merged

update docker build#1872
ovowei merged 1 commit intomainfrom
fix-docker-build

Conversation

@ovowei
Copy link
Collaborator

@ovowei ovowei commented Feb 28, 2026

What does this PR do?

Fixes # (issue)

Before submitting

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 refactors the Docker build process to introduce conditional compilation for fine-tuning components. Previously, the Docker image always included a 'fine-tune' environment with LLaMA-Factory and related dependencies. Now, these components are only included if the FUNCTIONALITY build argument is explicitly set to 'sft'. This change allows for more lightweight Docker images when only serving models is needed, optimizing resource usage and build efficiency by avoiding unnecessary installations.

Highlights

  • Conditional Fine-tuning Environment: The Dockerfile has been updated to conditionally create and configure the 'fine-tune' conda environment, including its dependencies like LLaMA-Factory, ktransformers, and flash_attn, only when the FUNCTIONALITY build argument is set to 'sft'.
  • Reduced Docker Image Size and Build Time: By making the fine-tuning components optional, the Docker image can be built without these heavy dependencies when only the 'serve' functionality is required, leading to smaller image sizes and faster build times for non-SFT (Supervised Fine-Tuning) use cases.
  • Build Argument Integration: A new FUNCTIONALITY build argument, defaulting to 'sft', has been introduced in the Dockerfile and integrated into the build-docker-tar.sh and push-to-dockerhub.sh scripts to control the conditional build process.
  • Streamlined Version Extraction: The docker-utils.sh script was modified to no longer require LLaMA-Factory version extraction for image naming, accommodating scenarios where LLaMA-Factory is not installed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docker/Dockerfile
    • Added a new FUNCTIONALITY build argument with a default value of 'sft'.
    • Modified the creation of the 'fine-tune' conda environment to be conditional based on the FUNCTIONALITY argument.
    • Updated pip mirror configuration for the 'fine-tune' environment to be conditional.
    • Made the cloning of the LLaMA-Factory repository conditional.
    • Ensured the downloading and installation of ktransformers and flash_attn wheels are conditional.
    • Applied conditional logic to the installation of PyTorch, LLaMA-Factory, and NCCL within the 'fine-tune' environment.
    • Made the cleanup of downloaded wheels conditional.
    • Modified the creation of the 'finetune' shell alias to be conditional.
    • Updated the LLaMA-Factory version extraction process to be conditional and provide a 'none' value if not installed.
  • docker/build-docker-tar.sh
    • Added the FUNCTIONALITY build argument to the Docker build command.
  • docker/docker-utils.sh
    • Removed the requirement for llama_ver to be present during version validation for image name generation.
  • docker/push-to-dockerhub.sh
    • Added the FUNCTIONALITY build argument to the Docker build commands in two separate functions.
Activity
  • The pull request description includes a checklist for contributor guidelines and necessary tests, but no human comments or reviews have been recorded yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ovowei ovowei merged commit 19887e4 into main Feb 28, 2026
6 checks passed
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a FUNCTIONALITY argument to the Docker build process, allowing for the creation of more specialized Docker images. By making the installation of fine-tuning related components (like LLaMA-Factory, its dependencies, and the fine-tune conda environment) conditional on this argument, the PR effectively optimizes image size and build time for inference-only (infer) scenarios. The changes are well-implemented across the Dockerfile and associated build scripts, ensuring that the new functionality is correctly propagated and handled. This is a significant improvement for managing Docker image variants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant