Posts

Showing posts from May, 2019

Multi-stage Docker Build

How Multi-stage Build Works Demonstrating docker multi-stage builds which helps to build smaller docker images. This process also referred as Docker’s BUILDER PATTERN — ThirupathiReddy Vajjala One of the most challenging things about building images is keeping the image size down. Multi-stage builds are a new feature requiring Docker 17.05 or higher on the daemon and client. It was actually very common to have one Dockerfile to use for development (which contained everything needed to build your application), and a slimmed-down one to use for production, which only contained your application and exactly what was needed to run it. How Multi-stage Build Works With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the fi