Collapse CI Dockerfile into a single layer
authorMark Hansen <mark@markhansen.co.nz>
Sat, 16 May 2020 05:04:29 +0000 (15:04 +1000)
committerMark Hansen <mark@markhansen.co.nz>
Sun, 17 May 2020 01:10:12 +0000 (11:10 +1000)
commit167dc46f5c003f913d37428f8567e99008edd004
tree96f1ab12703bf71de1136164f76be179c9c6bb34
parent1be9b598bdb0e18e1233749412b9fa943c1489b4
Collapse CI Dockerfile into a single layer

Speed up CI Docker build: apt-get update once

This is cribbed from
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get,
particularly the 'well-formed RUN instruction that demonstrates all the
apt-get recommendations'.

This ensures that:

- apt-get has a lot of parallelism available to speed up downloading of
  packages
- apt-get only has to read package information into memory once
  (speeding up the build)
- one single revision of the Ubuntu package sets are used by all apt-get
  installs (previously if Ubuntu updates packages between RUN commands
  we might get packages from different revisions - unlikely but
  possible)
- the /var/lib/apt/lists/* files are not present in any docker
  filesystem layer, saving space (previously they were present in all
  layers but the last layer, so the removal at the end didn't save any
  space)
ci/ubuntu-18.04/Dockerfile
ci/ubuntu-19.04/Dockerfile
ci/ubuntu-19.10/Dockerfile
ci/ubuntu-20.04/Dockerfile