-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
We have been starting to pursue (with apko) the next generation of "distroless" tooling, and that has made curating images with complex dependencies (e.g. git) much more tractable than the old model. I chased the idea of "distroless git" years ago when we were starting knative/build and the dependency tree made this a nightmare, but with the new tooling, it's actually very tight!
I put together github.com/distroless/git largely based on the Tekton Dockerfile's apk add line: https://github.com/distroless/git/blob/1473a6a03596395baa6e99221405467c94f69798/.apko.yaml#L8-L10
Since this is a "distroless" image, it is actually smaller than what y'all have today (though since the bulk of it is from git, the difference isn't huge):
ls -l *.tar
-rw-r--r-- 1 mattmoor staff 35812864 Apr 12 08:18 bar.tar <-- apko
-rw-r--r-- 1 mattmoor staff 38889472 Apr 12 08:09 foo.tar <-- upstream (Dockerfile)
Another place worth considering a switch is your use of gcr.io/distroless/base:debug for your "shell image" here:
pipeline/config/controller.yaml
Lines 78 to 81 in 5ac6ef7
| # The shell image must be root in order to create directories and copy files to PVCs. | |
| # gcr.io/distroless/base:debug as of February 17, 2022 | |
| # image shall not contains tag, so it will be supported on a runtime like cri-o | |
| "-shell-image", "gcr.io/distroless/base@sha256:3cebc059e7e52a4f5a389aa6788ac2b582227d7953933194764ea434f4d70d64", |
This uses base:debug vs. static:debug because the latter doesn't exist, but really all you are after is the fact that :debug contains busybox. We created github.com/distroless/busybox for this, which (without glibc) is considerably smaller:
ls -l *.tar
-rw-r--r-- 1 mattmoor staff 5142016 Apr 12 12:52 bar.tar <-- apko
-rw-r--r-- 1 mattmoor staff 23222272 Apr 12 12:51 foo.tar <-- upstream distroless
We have been using ghcr.io/distroless/git and ghcr.io/distroless/busybox for each of these in our downstream testing for several days now without issue, and so I wanted to start a discussion around replacing these upstream (and eliminating the need to maintain the git-init Dockerfile + builds)...