I’ve been searching through the documentation and can’t seem to find a way to do make multistage builds efficient when needing to rebuild without a cache from a specific step. I’m in a situation where I have a multistage build that installs a bunch of prerequisite on one image, but the secondary stage may need to be rebuilt without a cache. The primary stage will never need to be rebuilt without the cache.
I would like to leverage multistage builds for production because it makes it significantly simpler to build a consistent image, but when I need to rebuild the second portion of the image, if I use --no-cache it will rebuild both stages of the build.
Is there a way to rebuild only the second/third/etc stage of a multistage build from cache, without also rebuilding the first stage without cache, or am I stuck going back to the old methods of using multiple dockerfiles, one for the first stage, another for subsequent stages?
Thanks in advance,
-Mike