SpotBugs: Are multiple docker images with different dependencies preferable to a single docker image containing all dependencies?
Problem to solve
Now that SpotBugs contains Java 8 and Java 11, it has an image size of around 1.5GB. Image sizes this large become impractical: it's harder to test locally on a poor internet connection, builds take longer, more disk space is used, etc. As we support more versions of Java (and other dependencies), we expect this image to grow unsustainably in size.
Note that I'm making this issue SpotBugs specific, because I don't know if it applies more generally or not.
Intended users
~"GitLab Enterprise Edition"
As is
Currently, for SpotBugs, we build a single docker image containing all required versions of all dependencies. At runtime, environment variables are used to determine target versions to use during the Analyze execution.
At time of writing, dependencies include:
Ant, Gradle, Grails, Maven, Scala, SBT and Java. Java is the only dependency that we have multiple versions of, all of the other dependencies rely on a relatively up-to-date version of the tool.
Proposed changes
Split the SpotBugs docker image into two, one for each version of Java. An image for each version of Java would be built when the pipeline runs, and we would need some way of choosing the appropriate image based on environment variables when the Analyzer is executed.