Hacker News new | past | comments | ask | show | jobs | submit login

It is possible with build stages and copy from, but yeah not super trivial.



Definitely not trivial, but staged builds are my go-to solution. Depending on the specifics of the tech you're including it can be a lot easier than figuring out how to clean up every little build artifact within a layer - just add a second FROM line and copy precisely the pieces you need in the final image, and nothing else.

I also think it makes the build stage a lot easier to follow for people who aren't as familiar with Dockerfiles and all the quirks that come with optimizing a final image.


Exactly. You need to remember to do it and restructure your build at least slightly to do so. It isn't hard but non-default and annoying.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: