Skip to content

[CI] Optimize docker build to fix disk space issues#85

Merged
Luohaothu merged 2 commits intomasterfrom
fix-docker-build
Jan 28, 2026
Merged

[CI] Optimize docker build to fix disk space issues#85
Luohaothu merged 2 commits intomasterfrom
fix-docker-build

Conversation

@Luohaothu
Copy link
Contributor

@Luohaothu Luohaothu commented Jan 28, 2026

Summary by CodeRabbit

  • Chores
    • Added pre-build disk cleanup in CI to reduce failures and improve pipeline reliability.
    • Consolidated compiler build steps in Docker to streamline the build process, reduce image size, and improve build efficiency and consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Added a pre-checkout disk cleanup step to the GitHub Actions workflow and consolidated multi-step GCC and LLVM/Clang build sequences in the Dockerfile into single chained RUN commands with integrated cleanup.

Changes

Cohort / File(s) Summary
CI workflow disk optimization
/.github/workflows/docker-build.yml
Added a "Free up disk space" step that runs sudo apt-get clean, sudo apt-get autoremove -y, removes /usr/share/dotnet, /usr/local/lib/android, /opt/ghc, and runs df -h before checkout.
Docker build step consolidation
scripts/Dockerfile
Replaced multi-stage/multi-RUN GCC and LLVM/Clang build steps with single chained RUN commands that clone sources, create build dirs, configure/build/install, and remove build artifacts within the same RUN; removed separate final cleanup RUNs.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • [CI] Update docker file #84: Modifies the same CI workflow and Dockerfile with related disk cleanup and build-step consolidation changes.

Poem

🐰 I hopped into runners, nose to the breeze,
Cleared crumbs of the build with a flurry of sleaze,
Stitched GCC and LLVM in one tidy run,
Now images sleep lighter when morning comes. 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main change: optimizing the Docker build configuration to address disk space constraints by adding cleanup steps and consolidating build commands.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Luohaothu
Copy link
Contributor Author

/gemini review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/Dockerfile (1)

67-85: Fix broken WORKDIR after deleting /llvm-build.

You delete /llvm-build inside the RUN, but WORKDIR /llvm-build remains in effect for subsequent RUNs; the next RUN echo ... will fail because the working directory no longer exists. Add a WORKDIR / immediately after this RUN (or stop deleting the directory).

🔧 Proposed fix
 RUN git clone --depth 1 --branch "llvmorg-${LLVM_VERSION}" --single-branch \
         https://mirrors.tuna.tsinghua.edu.cn/git/llvm-project.git llvm-project && \
     mkdir -p build && \
     cd build && \
     cmake -G Ninja \
@@
     ninja && \
     ninja install && \
     cd / && \
     rm -rf /llvm-build
+
+WORKDIR /

Copy link

@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 significantly optimizes the Docker build process by consolidating build steps and implementing immediate cleanup of build artifacts for both GCC and LLVM. These changes effectively reduce the number of Docker layers and the final image size, directly addressing the stated goal of fixing disk space issues and streamlining the CI/CD pipeline. The modifications are well-executed and represent a clear improvement in efficiency and resource management for the Docker image builds.

@Luohaothu Luohaothu merged commit e7b06f8 into master Jan 28, 2026
2 of 3 checks passed
@Luohaothu Luohaothu deleted the fix-docker-build branch January 28, 2026 04:36
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