mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2026-01-11 21:10:25 +01:00
Improve Dockerfile #56
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jlxip on GitHub (Jul 8, 2020).
The Dockerfile could definitely have some improvements that would make the final image a lot smaller.
archlinuxas the base image (which is 415MB)? Should check ifubuntu(74MB) oralpine(5.6MB) do the trick. Ifarchlinuxis actually necessary because of some needed newer features, then no problem there.RUNcommand in the Dockerfile adds a new layer, so it doubles the size of the final image. Most Dockerfiles are doable in one or twoRUNcommands. Either that or use multi-stage Docker builds (more info here).WORKDIRcould be perfectly avoided by just usingcd.COPY, which would make changing them a lot easier and avoid working with the line terminator\as much as possible, which is always a good thing.RUN, once it gets down to one or two of that instruction, should be in a separate shell script which would benefit from the maintainability perks of the previous point.@sickcodes commented on GitHub (Jul 8, 2020):
You can rewrite it in Alpine if you’d like. It’s for people so they can change the Dockerfile. Someone mentioned earlier a problem with Alpine. Arch is well known, good support, other Arch users can easily add PR’s.
Not sure about that. I will look into it. The biggest part of the image is the .img.
Docker documentation recommends WORKDIR over cd, if that recommendation has changed let me know.
I like dockerfiles that have everything in the one file. You can paste it anywhere. Store it in an email, in a photo, in a note, print it out.
I would say that 1 single file is more maintainable than a series of shell scripts. I am big believer of KIS.
Good idea. Want to submit a PR?
@sickcodes commented on GitHub (Mar 10, 2021):
WORKDIRwhen necessaryClosing as seem to have covered most of these points by now, thank you!