Interview Prep/Docker/Build Performance & CI

A build is slow because of a 2 GB context. How do you diagnose and fix it?

BeginnerProductionBuild Performance & CI
Answer

The output line transferring context: 2.1GB gives it away. Find large dirs with du -sh * | sort -h, add them to .dockerignore (node_modules, .git, dist, datasets, *.tar), or use a whitelist style (* then !src, !package.json). With BuildKit, --progress=plain shows each step's timing.

All Docker questions Roadmap: Docker & containers

More on Build Performance & CI