-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerfile using multi-stage build (take #2) #209
Comments
I'm still confused on what switching to a multi-stage build here brings us? What's the benefit which we can't get right now that makes the switch worthwhile? I'm also not sure which special case in https://github.com/docker-library/faq#multi-stage-builds this is falling into, but I guess that's really a specialization of my first question. 😅 |
Defining worthwhile is the right question here. Here is one angle:
Is 24% smaller worthwhile? I don't know. IMHO, at scale, it's a lot of bandwidth for the planet when you addition the billions of pulls from every docker images (not only Ghost). AWS is happy that we don't multi-stage these images yet. PS. The images above are for Ghost 2. Why? Because since Ghost V3 the alpine version is breaking. |
We try hard to avoid multi-stage builds in almost every instance. One of the major issues we have with multi-stage builds is below.
The on-disk size is a bit interesting: REPOSITORY TAG IMAGE ID CREATED SIZE
ghost 2.38-alpine 4a8ba9a19754 2 weeks ago 322MB
devmtl/ghostfire 2.37.0_2019-11-11_04H05s12_549e5d5 a0be566da8a1 2 months ago 225MB What I would like to do is see where our image could change without a multi-stage build to improve both on-disk as well as transport size. I would guess that the biggest differences are not keeping |
Thank you for sharing the big picture here! This is exactly what my multi-stage build (MSB) allows. This is the opportunity to save 20MB (or 100MB on disk).
Do you mean at micro-level (this Ghost image) or at the macro-level (official core images like Node)? At the micro-level, I don't see the risk.
A new Tag?1) With MSB, we can push multiple docker images from the same Dockerfile. Idea: What about introducing a new a 2) If we are going that route, this would allows us to remove many Dockerfiles (yeah less maintenance!) and have a bigger MS Dockerfile that push N docker images. Specifically, let's take the example of Node Alpine. All these images could be generated from the same Dockerfile (instead of 8):
Using CachingI thought this was working out of the box. If it is not, my whole argument is not holding :-/
ConclusionSo in the end, I just want to share the work I did for the multi-stage build on Ghost :) I certainly don't want to challenge you on a topic like this. I know you carefully tough about the process. I know that you @yosifkit & @tianon been taking care of those docker images for years. I want to thank you. You are doing such a good job over here. Cheers! |
For those who are curious, I feel this is one way to manage an MS Dockerfile. |
Closing this as it as no value on this repo. If you are curious, this is how we do it at FirePress. |
Following on this closed issue. Reading this I feel it would make sense to do a PR.
Let me know if you interested. Thanks!
The text was updated successfully, but these errors were encountered: