Skip to content

ci: Reduce Fedora and Debian image sizes even more

Alex Turbov requested to merge zaufi/cmake:feature/improve-dockerfiles-2 into master

Apply the approach from !8145 (merged) to more stages.

Also:

  • Use cache (prefetch metadata and packages) to reduce network I/O and speedup image build.

  • Use tmpfs to drop logs produced by the package manager.

Results:

REPOSITORY      TAG                             IMAGE ID       CREATED         SIZE
after           deb10                           927acb2f37b9   11 hours ago    3.24GB
kitware/cmake   ci-debian10-x86_64-2023-02-06   8349f2cd975b   24 hours ago    3.55GB

after           fc37                            a320ee7d6d03   13 hours ago    3.31GB
kitware/cmake   ci-fedora37-x86_64-2023-02-06   9ce0b7d1ae83   24 hours ago    3.9GB
  • -310M for debian
  • -590M for fedora

Build time:

$ docker build -t before:deb10 --no-cache .
[+] Building 830.9s (14/14) FINISHED

vs

$ docker build -t after:deb10 --no-cache .
[+] Building 738.8s (17/17) FINISHED

1.5 minutes (~11%) faster build time ;-) (debian)

Backport: release
Topic-rename: ci-docker

Edited by Brad King

Merge request reports