A CI pipeline that used to take 3 minutes now takes 18 minutes after a team grew its monorepo
The build stage rebuilds the full Docker image from scratch on every run with no apparent caching. Diagnose the likely causes and propose fixes. Expected reasoning: check whether the CI runner is ephemeral (fresh VM/container per job) with no persisted build cache, in which case every run genuinely starts cold; introduce platform-native caching (GitHub Actions cache, or a registry-based --cache-from/--cache-to with BuildKit) so layers persist across runs. Also check Dockerfile instruction ordering for unnecessary cache invalidation (Chapter 2/3) and confirm .dockerignore is excluding unrelated
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response