Enable cache for pre-stage in multi-stage docker build
Since we are using multi-stage docker builds, the final image has no intermediate layes - just the layers from base image and one COPY layer. This defeats the purpose of caching that we implemented in !81 (merged).
This MR implements a workaround for having cache. It includes
- Creating builder images from the first stage of our multi-stage builds. These are old, bulky images that we used to ship to the customers before multi-stage builds.
- Use these builder images as cache for subsequent builds. This way, intermediate layers are available for builds.
The pros are:
- Builds take way less amount of time to complete.
- Users still get the slim version, nothing changes there.
The cons are:
- We end up using more space in our registry.
Original idea from: https://github.com/moby/moby/issues/34715#issue-254897142
Edited by Balasankar 'Balu' C