go mod download for faster Dockerfile #409
Merged
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.
go mod download will help to download all dependencies before coping over the code. This won't help allot in your local environment but if you run this in a CI/CD pipeline you will see a increase if you run the build multiple time at the same server due to docker caching.
Since go creates a bin and the COPY command sets the owner to the current user we don't have to do any chown until the bin is ready.
I assume that dockerhub should still be happy with the dockerfile since we are using USER in the final container.
I only did this update in one file, if you think this is a good idea i will do it in the rest of them.