Skip to content

Reorder docker build

Kristian Larsson requested to merge 178-reorder-docker-build into master

By reordering our commands and placing apt commands earlier in each stage, we can avoid rerunning apt installs, which tend to be rather slow.

For example, building the images for NSO 5.3 for the first time means we run the entire install from scratch. Downloading things with apt and installing takes several minutes. Building all the Docker images is upwards of 5 minutes. Since copying in the NSO directory used to be the first step, repeating that build for NSO 5.4 would take just as long. With this new version, all the apt commands are cached and building the images for a different NSO version completes in under a minute on my workstation.

There really are no real downsides to this ordering.

We previously used the extra-files dir to host a apt sources for buster backports. Since we now reversed the order, and we need the sources files before we do the apt install, I had to replace that file. Instead we just echo its content at the beginning of the build. It's probably easier to maintain this too as when we switch from debian:buster to something later, it's now all in the Dockerfile and not spread out in multiple files.

Closes #178 (closed)

Merge request reports