News for hackers. Stuff that matters.
Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by chung1905 on Sunday October 20, 2019 @09:40PM (#21308704)
While developing an image, I use layers as much as possible. But usually, when the image is finished, I prefer to minimize the number of layers, it saves some (or little) storage (I think it will not > 10%).
Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by londons_explore on Monday October 21, 2019 @02:46AM (#21309845)
Fewer layers also performs better in the final image. Things like listing a directory get very slow with thousands of layers.
Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by Leace on Monday October 21, 2019 @07:06AM (#21310886)
I suggest reading about multi-stage builds. They basically squash layers at the end so it's a "have cake and eat it too" scenario.

This pattern of concatenating commands to have a minimal image is a workaround from times when multi-stage builds were not available.

Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by annymsMthd on Monday October 21, 2019 @11:54AM (#21313694)
Multistage builds do not squash at the end.
Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by chatmasta on Monday October 21, 2019 @06:33PM (#21318277)
Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by pm7 on Monday October 21, 2019 @07:23AM (#21310971)
@Leace

> I suggest reading about multi-stage builds. They basically squash layers at the end so it's a "have cake and eat it too" scenario.

That's completely different thing. Multi-stage builds are great for separating build environment from production environment, but if you need several layers for production environment, they won't be squashed. See here: https://github.com/docker/compose/issues/4235#issuecomment-3...

Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by mnutt on Monday October 21, 2019 @12:48PM (#21314401)
Yeah, I suspect that while the author could use a development image to do all of the compiling, given that all of the nginx files are not in a single directory it's my understanding that you'd need multiple COPY commands, and you'd still want to do all of the package manager operations in the prod build. It's really a tradeoff of development ease vs minimal packaged output.
Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by pm7 on Monday October 21, 2019 @01:35PM (#21314945)
> given that all of the nginx files are not in a single directory it's my understanding that you'd need multiple COPY commands

Workaround would be to move these files to one directory on host, COPY it in one command to /tmp (or even better, /dev/shm or other ramdisk) and then use script to distribute files where needed.

Re:Show HN: Nginx Image with HTTP/3 (QUIC), TLS1.3 with 0-RT... by chatmasta on Monday October 21, 2019 @06:35PM (#21318292)
You can make the multi-stage builds actual images themselves, and setup your CI to auto push them to a registry. Then you can have shared multistage builds, which is pretty useful for things like compiling static libraries in their own images, and COPYing them into images that statically link to them.