Skip to content

docker: Optimize image size by purging apt cache in dev stage#9806

Open
Divinesoumyadip wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:docker-optimization
Open

docker: Optimize image size by purging apt cache in dev stage#9806
Divinesoumyadip wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:docker-optimization

Conversation

@Divinesoumyadip
Copy link
Contributor

It's optimizes the main Dockerfile by cleaning up the apt package cache within the dev stage.

Added apt-get clean and rm -rf /var/lib/apt/lists/* to the dev stage RUN block.Ensures that temporary package lists are not persisted in the Docker layers, resulting in a smaller base image for the builder and final stages.

Reduces the overall footprint of the OpenROAD development and release images, leading to faster CI/CD build times and quicker downloads for end-users. This directly supports the Onboarding Simplification project's goal of making installation options more robust and efficient.

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 two valuable improvements under the umbrella of 'Onboarding Simplification'. First, it optimizes the Docker image size by adding commands to clean the apt cache within the dev stage, which is a great practice for creating smaller images. Second, it enhances the Build.sh script by adding pre-flight checks for essential build dependencies. This will improve the developer experience by providing early and clear feedback if required tools are missing.

The implementation is solid. I have one minor suggestion for the Build.sh script to make the new compiler check even more robust by handling unknown compiler options.

I am having trouble creating individual review comments. Click here to see my feedback.

etc/Build.sh (243-252)

medium

The pre-flight check for compilers is a great addition. However, it currently only checks for gcc, clang, and clang-16. If a user specifies a different compiler, the check is silently skipped, and the build might fail later with a less clear error message. To make this check more robust and user-friendly, consider adding an else block to handle unknown compiler values by printing a warning.

if [[ "${compiler:-gcc}" == "gcc" ]]; then check_command "gcc" check_command "g++" elif [[ "${compiler}" == "clang" ]]; then check_command "clang" check_command "clang++" elif [[ "${compiler}" == "clang-16" ]]; then check_command "clang-16" check_command "clang++-16" else echo -e "${YELLOW}[WARNING] Unsupported compiler '${compiler}' specified. The build may fail. Skipping compiler pre-flight check.${NC}" fi 
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@maliberty maliberty requested a review from sombraSoft March 18, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant