Skip to content

[CNG] Centralize installation of common components into gitlab-base

Summary

We should consider the centralization of certain common tooling components into the gitlab-base image, even if a few of the images FROM gitlab-base are not using them. These layers are not large, however the result in multiple separate yet identical resources for the containers, and blobs within storage.

Eventually, we want to migrate to a consistent use of gomplate across most containers, which includes the refactoring of gitlab-container-registry. Performing this work in addition to ensuring all images are based upon gitlab-base, we'll actually improve performance for: pipelines, image consumption, application Pod start-up time (fewer dissimilar layers)

Current behavior

gitlab-rails/Dockerfile.erb:212:COPY --from=gomplate /gomplate /usr/local/bin/gomplate
gitlab-pages/Dockerfile:51:COPY --from=gomplate /gomplate /usr/local/bin/gomplate
gitlab-container-registry/Dockerfile:43:COPY --from=gomplate /gomplate /usr/local/bin/gomplate
gitlab-shell/Dockerfile:58:COPY --from=gomplate /gomplate /assets/usr/local/bin/gomplate
gitlab-workhorse/Dockerfile:53:COPY --from=gomplate /gomplate /usr/local/bin/gomplate

We have 5 separate instances of placing gomplate into final service containers. This can be a single component layer, in place of a distinct layer across this many.

gitlab-sidekiq/Dockerfile:37:COPY --from=gitlab-logger /gitlab-logger /usr/local/bin/gitlab-logger
gitaly/Dockerfile:95:COPY --from=logger /gitlab-logger /usr/local/bin
gitlab-shell/Dockerfile:57:COPY --from=gitlab-logger /gitlab-logger /assets/usr/local/bin/gitlab-logger
gitlab-webservice/Dockerfile:24:COPY --from=gitlab-logger /gitlab-logger /usr/local/bin/gitlab-logger

We have 4 separate instances of placing gitlab-logger into final service containers. This can be a single component layer, in place of a distinct layer across this many.

Expected behavior

  • Only gitlab-base has instructions to install gomplate and gitlab-logger
  • All reasonable service images are based upon gitlab-base, removing the need to add these individually
Edited by Robert Marshall