Investigate use of --install-root argument to microdnf

Summary

As part of Investigation: methodology for creating final l... (#8 - closed), explore using --installroot and associated arguments to microdnf, in order to build out a chrooted ubi-micro environment.

Details

We investigated building the gitlab_base image using--installroot and associated arguments to microdnf in following steps:

  1. start with a ubi8-micro image, create dir /install-root/ and copy the / folder into /install-root/.
  2. copy /install-root/ from the previous step into the builder image(ubi8-minimal).
  3. use microdnf to install the required software in /install-root/ folder using the --installroot and associated arguments.
  4. Create gitlab_base image from ubi8-micro and copy /install-root/ from builder image into /

We also investigated installing required software into ubi8-micro using redhat's documentation that uses buildah to install the software.

Findings

  1. Using --installroot and associated arguments to microdnf produces a gitlab_base image of size 92MB. We also checked this image for wasted space using 'wagoodman/dive' utility and found the final image size to be acceptable size(see attached screenshot of dive analysis). We also verified that with this approach, all the required software is installed and functions correctly.
    It is important to start with ubi8-micro and copy it's / folder to /install-root/ rather than using empty /install-root/ folder as the --installroot in the builder image(ubi8-minimal). Please see this note from @WarheadsSE for a good explaination.
  2. The image produced using buildah (per Red Hat's documentation) produces a image of size 352MB and may require significant changes to the pipelines hence we decided to not use this approach and use the --installroot approach detailed above.
Edited by Vasant Tokale