It seems like a slightly unfair comparison of size in the end, when the original image installed Git with RUN apk update && apk add git, while that it left out in the multi-stage builds. From what I can see from a simple test, that accounts for 17 MB of the 21/25 MB difference noted in the article.
RUN apk update && apk add git
I think that’s the entire point of the article? Using one stage where you don’t give a fuck about the size and then you only care about the final stage size…
Sure, but adding extra - seemingly unnecessary - dependencies to the “before” example and removing them in the “after” example, without any mention of why they were there in the first place or why they are unnecessary afterwards doesn’t make for a good comparison. Especially when the vast majority of the size difference comes from this one line being absent in the final solution.
Oh I see what you mean, you’re saying git was never even needed in the development build.
Fwiw I think the article may have been updated since you posted because I don’t see git being installed in any Dockerfiles
It has indeed!