Skip to content

Changes to base the final image on ubi-micro

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do?

Refactor the Dockerfile file so that the final image is based on ubi8-micro image.

The Dockerfile was refactored so that the final image is based on ubi8-micro instead of ubi8-minimal. A ubi8 image is used as the build stage. In the build stage a alternate file system is created at the ARG DNF_INSTALL_ROOT location. To start with, the entire file system of ubi8-micro is copied in this location:
COPY --from=initial / ${DNF_INSTALL_ROOT}/
This file system is then used as the destination for installing software required in the final image. ARG DNF_OPTS_ROOT is used to pass options to the dnf commands so the software is installed in alternate location(DNF_INSTALL_ROOT). This location is also used to copy files/directories from local file system and from previous stages as well as for changing file permissions required in the final image.

Once the changes to DNF_INSTALL_ROOT are completed, this file system is copied to the root of the final image based on ubi8-micro. Any changes/installations that cannot be done using alternate paths, such as, pip3 install, pipenv etc. are then done in the final image.

What are the relevant issue numbers?

gitlab-org/cloud-native/distroless/ubi#38 (closed)

Does this MR meet the acceptance criteria?

Edited by Adam Cohen

Merge request reports