3 ms·
This is how C/C++ services are done in production, too. You have a build step that does `apk add --update alpine-sdk git cmake` etc., builds the service, and th
by junon 6y ago
This is how C/C++ services are done in production, too. You have a build step that does `apk add --update alpine-sdk git cmake` etc., builds the service, and then you start again fresh with a FROM (new stage) and `COPY --from` over the build artifacts.
Reading this thread I'm surprised this isn't common knowledge by now given how it's so incredibly paramount to efficient production releases.
- dkarp 6y agoIt may well be common knowledge now. I discovered it when writing our Dockerfiles earlier this year and before that hadn't seen it. It looks like multi-stage builds were added to the best practices in 2018 [https://github.com/docker/docker.github.io/blob/master/develop/develop-images/multistage-build.md https://github.com/docker/docker.github.io/blob/master/devel...] which is probably why I missed it before