containerbuildsystem / cachi2

GNU General Public License v3.0
5 stars 20 forks source link

Convert the cachi2 image to a multi stage docker build #544

Closed eskultety closed 2 weeks ago

eskultety commented 1 month ago

The motivation behind this PR stems from the following:

  1. ever since we started pre-installing Go SDKs into the images the image size grew out of hand (>2x)
  2. the injected Go SDK installs make it impossible (among a couple of other blockers) for cachi2 itself be hermetically built because we'd have to come up with an ugly mechanism to prefetch the Go SDKs to be injected into the final image
  3. slow image builds due to the size of the Go SDKs that had to be downloaded each time; this is particularly annoying with running integration tests locally since the image is rebuilt with every commit when run in an interactive rebase EDIT: Tests have shown that the RPM layers in a multi-stage scenario are rebuilt every time, so ^this issue will only be alleviated only slightly
  4. we have an artificial dependency on nodejs via the js-deps directory which was only ever meant to be a build aid to make sure that: a) we're working with new enough Node that ships with corepack b) we're enabling and hence installing the correct Yarn version (v3) in the final image (Note: Yarn installation needs a namespace not to create artifacts on the global level for which we used the js-deps directory)
  5. Installing cachi2 and all its dependencies via pip to the global pip module store as root (i.e. /usr/lib)

Depends on: https://github.com/containerbuildsystem/cachi2/pull/528

Maintainers will complete the following section

Note: if the contribution is external (not from an organization member), the CI pipeline will not run automatically. After verifying that the CI is safe to run:

eskultety commented 2 weeks ago

Since v1:

eskultety commented 2 weeks ago

Rebased on top of main.