10x smaller Docker image #869
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.
This PR would merge these 3 commits:
Dockerfile rewrite
Add build script to .dockerignore
Add build script because I forgot to in the previous commit
The Dockerfile rewrite commit contains the bulk of the changes. It now employs a 2-stage build process in which everything from the initial build stage is discarded except the build artifacts that matter, which are then brought forward into a new instance of the base image.
The various scripts (src.sh, ubuntu.sh, pip.sh, etc) are folded directly into the Dockerfile and are redundant for the purpose of building a Docker image if these commits are merged, but I left them intact since the Wiki looks like it makes reference to them for people building binwalk from scratch. The bulk of the content from the scripts are now within two individual
RUN
commands in the Dockerfile.These changes result in a final docker image that builds faster, has fewer layers, and is ~10x smaller than the docker image produced when following the instructions on the wiki here.:
The rust compiler & toolchain, clang & friends, unnecessary build artifacts, apt cache, etc. are absent in the final image, which makes a dramatic difference in size vs. the instructions on the wiki to build a Docker image.