Add linting of dockerfiles
Currently we have no linting for our numerous dockerfiles. This means enforcing style guidelines has to be done manually by reviewers, and catching simple errors happens when the docker images are built which is by neccessity near the end of our pipeline.
We should add a stage that provides dockerfile linting. After some research there seems to be two main dockerfile linter options:
-
hadolint - which seems great at first as it is quite thorough with its rules features and configurability, however it's missing some features such as awareness of the
escape
directive, so given our multi-OS zoo of dockerfiles it's likely not appropriate for us. - dockerfile-utils - the output and configurability seem a little less full featured than hadolint, but it does support the full set of directives. This is what the VS Code dockerfile extension uses to do it's inline linting: