ci: simplify Dockerfile and add docker image testing #10021
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dockerfile
This change splits the builder stage into builder and utilities stages. This is to make the distinction between buildtime and runtime dependencies clearer. More importantly, this makes sure that the runtime dependencies we download are for the target platform.
It also install
tini
andsu-exec
* from APT repository rather than GitHub. This makes the installs simpler because we don't have to checkout git repos anymore.Finally, it replaces
su-exec
withgosu
. This is becausesu-exec
is not distributed through APT. However,gosu
comes in at around 2MB whilesu-exec
is ~20KB. Let me know if we should go back tosu-exec
for the size benefits.GitHub Actions
This PR adds bare minimum testing of produced images. It adds it to both
docker-build
anddocker-image
workflows (Should we get rid ofdocker-build
one?). The testing consists of running--version
in the produced image.In case of
docker-image
, I had to splitdocker-build-and-publish
into build and publish phases. Furthermore, I had to split build into 3 separate builds for each platform. This is because we want all the produced images loaded and it's impossible to do with multi-platform build.The testing in
docker-image
all happens onamd64
instance. So other platforms are being emulated.Testing
Fixes ARM images and:
closes #9901
closes #7541