DDLS-444 add linting to github actions #1799
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Add linting to our Dockerfiles
Fixes DDLS-444
Approach
Decided to use hadolint as it's a popular tool and can be used securely. It has a github action but I actually like just using the docker container for a few reasons.
Firstly it's really easy to programmatically get all our dockerfiles in the repo and chevron them through to the docker container. We can also mount the single file for the config.
Secondly I like that it shows how you can recreate the issues locally by using the same command.
Finally as an edge case it's more secure, as a docker image that was compromised still doesn't have access to env vars or the filesystem and we simply push particular files into it at run time. An action on the other hand has a wider scope of things it can do with regards to the file system.
I've fixed most things. I've set a few to ignore. In particular I'm ignoring pinning of certain packages we specify in the dockerfile as I don't think renovate will handle updates for them and we deploy based on fixed images so if something were to break it wouldn't make it to prod and it means we're always up to date with the docker 'os' (so to speak). Will revisit my thinking around this but this is what I've gone for for now.
Learning
NA
Checklist
Frontend