multistaged build for spark_driver reduces image size #3
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.
I stumbled upon this repo when doing the "Big Data, Hadoop, and Spark Basics" course on edX
The thing is that
RUN rm ...
doesn't help to make the images smaller cause it creates yet another layer leaving the previous one in the imageI propose the following changes to the Dockerfile to make the multistage build and consequently to make the resulting image considerably smaller
Note that you'll have to change the build.sh correspondingly to use the target argument
--target spark
Also note that I had to change to spark-3.1.3 since spark-3.1.2 is not available any more from apache.org
I checked that the proposed changes work
docker build --target spark -t wr0ngc0degen/spark_driver .
image: romeokienzler/spark_driver:3.1.2
-->image: wr0ngc0degen/spark_driver