CNG: gitlab-shell image contain excess
Summary
While looking at a proposal in https://gitlab.com/gitlab-org/gitlab-shell, I realized we should re-check our gitlab-shell
image for content & size, as "GitLab Shell is written in Go, and needs a Go compiler to build. It still requires Ruby to build and test, but not to run."
We're packaging this image based on git-base
, which includes gitlab-go
and gitlab-ruby
. We include the entire source code tree, and binaries. Both of these items are excessive.
This waste of space in the image:
- consumes space in our Registry's backing store
- consumes ingress for customers (docker pull)
- consumes significant disk space on active nodes
Steps to reproduce
dive registry.gitlab.com/gitlab-org/build/cng/gitlab-shell:v14.7.0
(updated 2022-01-24) and see that the final image is 973 MB 1.4GB 1.32GB
Current behavior
We have an image built with runtimes and compilers that are not needed, as source content that is a waste of space.
Expected behavior
Container is based on debian:stretch-slim
(or buster-slim
), and has only the binaries and support items required by GitLab Shell & OpenSSH Server
Status
Significant reduction requires #2958 (closed)
Size of images as to April 20, 2022
image | compressed size | expanded size |
---|---|---|
debian | 332314618 | 916592422 |
ubi | 231695548 | 584856773 |
NOTE: gitlab-shell:main{-ubi8}
. Most of the image size is due to the use of gitlab-ruby
& gitlab-go
as a base. Note, that we are shipping the source, which takes up ~1M.