Make image builds faster for a monorepo with 20 services.
AdvancedScenarioCI/CD and production rollouts
Answer
Situation read → Shared context makes everything rebuild.
What I'd do → Use docker buildx bake with a docker-bake.hcl defining targets and shared base, per-service .dockerignore (via Dockerfile.dockerignore), COPY only the service path plus shared libs, remote cache and --set *.cache-to. Detect changed services in CI with git diff.
Why → Bake builds targets in parallel with shared cache.
Interview tip → Context size matters: use named contexts to limit it.
More on CI/CD and production rollouts
Design a GitHub Actions workflow that builds, scans and pushes an image.IntermediateZero-downtime deploy on a single Docker host.AdvancedDeploy via GitOps with image digests.IntermediateCanary a new image on a Swarm service.AdvancedDocker build is flaky in CI due to network errors on package installs.IntermediateRun database migrations in the deploy flow of containerized apps.Intermediate