Faster builds and slimmer images with Docker multistage builds
summary
Shows a concrete Dockerfile that replaces copying an external build with a single multi-stage pipeline that runs yarn install and produces gzip-compressed static files served by nginx, with measured runs hitting ~107 seconds the first time. Demonstrates using yarn cache mount and npm cache mount to cut repeated downloads, inspects layers with docker history (images grew from ~227MB to ~315MB without cache), uses cache-from/inline cache to make a Docker registry act as a distributed build cache, and parallelizes independent stages.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:52Inspecting Docker images
- 11:33Single-stage to multi-stage
- 16:22Private npm repositories
- 24:00Optimizing build cache
- 29:46Avoiding cache busting
- 33:50Distributed build caches
- 41:11Caching from multiple tags
- 43:42Parallelizing build steps
- 47:46Q&A
related talks
15mOptimizing Cache Usage in Docker Builds
24mSpeeding up Your Docker Image Build
58mOptions Galore to Get from Source Code to Container
29mDockerfile: the best practices
39mAbusing Docker builds with BuildKit and friends
05m3 Weird Tricks to Make Docker Builds Go Vroom
16mSimplifying the Journey of Your Containerized Application from Dev to Production
54mHowto: Options Galore to Get from Source Code to Container
