Skip to content

Gitaly: make debian multi-stage

Jason Plum requested to merge 2934-optimize-gitaly into master

What does this MR do?

Make the Debian based gitaly image a multi-stage image.

  • Switch build steps to as builder
  • Add /target stage to builder
  • Condense many items of mkdir/touch/chmod/chown to install
  • Set permissions on /scripts directly versus chown

Impact

$ docker inspect registry.gitlab.com/gitlab-org/build/cng/gitaly:master | jq -r '.[].Size'
2943972194
$ docker inspect registry.gitlab.com/gitlab-org/build/cng/gitaly:4f4c0e4595b918be42c4553921c8a90747f55756 | jq -r '.[].Size'
2026143608

917 MB saved

Impact of COPY --from=builder seen below, is largely due to the current need for cp -R --parents /usr/lib/ruby/gems/

Screenshot_20211110_113244

Related issues

Related to gitlab-org/charts/gitlab#2934 (closed)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Integration tests added to GitLab QA
  • The impact any change in container size has should be evaluated
Edited by Mitchell Nielsen

Merge request reports