Improve Dockerfile#392
Merged
romanz merged 3 commits intoromanz:masterfrom Apr 13, 2021
Merged
Conversation
added 3 commits
April 8, 2021 22:18
Reduce image size from ~860MB to ~470MB
Help reusing docker build cache.
Kixunil
approved these changes
Apr 9, 2021
Contributor
Kixunil
left a comment
There was a problem hiding this comment.
LGTM, if you've seen my brainfart, sorry about that.
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Running a bare
chown(or any other form of file modification, e.g.chmod) recursively on a directory tree in a Dockerfile comes with a cost: docker makes a copy of the whole layer to apply the change. Solvable with--chownargument toCOPY.Changes from:
to:
DockerfileorLICENSE, as they shouldn't be, as they don't affect the build/compilation.Possibly the same could be done for other directories, like
doc,internal, but I'm not familiar enough with the code to be confident to make that change. Ideally, theCOPY . .statement in the Dockerfile should be rewritten to only copy the necessary minimum to get the build done correctly.electrsexecutable, dropping these:This further reduces the docker image size to 88.8MB
I haven't done much testing on the functionality though. All I can say is that it starts: