by m463 · 2y ago · 0 comments
cramming everything into one RUN line to save space in a layer.
I really wish instead of:
RUN foo && \
bar && \
bletch
You could do: LAYER
RUN foo
RUN bar
RUN bletch
LAYER
or something similar.maybe even during development you could do:
docker build --ignore-layer .
then at the end: docker build .[0]: https://docs.docker.com/reference/dockerfile/#shell-form
[1]: https://www.docker.com/blog/introduction-to-heredocs-in-dock...
[2]: https://docs.podman.io/en/latest/markdown/podman-build.1.htm...
Docker should address it one day, but until then, we just have to do it in real world scenarios.
RUN foo
RUN bar
RUN baz
and then just build it with something like... I think kaniko did this last I looked?... that smashes the whole thing into a single layer. Obviously that has other tradeoffs (no reuse of layers) but depending on your usecase it can be a good trade to make (why yes, I did cut my teeth in an environment where very few images shared a base layer, why do you ask?).