docker: Optimize image size by purging apt cache in dev stage#9806
docker: Optimize image size by purging apt cache in dev stage#9806Divinesoumyadip wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Conversation
1d38538 to 38e979f Compare There was a problem hiding this comment.
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)
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 | clang-tidy review says "All clean, LGTM! 👍" |
Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
| clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
| clang-tidy review says "All clean, LGTM! 👍" |
It's optimizes the main Dockerfile by cleaning up the
aptpackage cache within thedevstage.Added
apt-get cleanandrm -rf /var/lib/apt/lists/*to thedevstageRUNblock.Ensures that temporary package lists are not persisted in the Docker layers, resulting in a smaller base image for thebuilderandfinalstages.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.