How do you share a common base layer across 30 microservices?
IntermediateScenarioMulti-stage builds, cache, tags and registries
Answer
Situation read → Repeating the same hardening steps in every Dockerfile wastes build time and drifts.
What I'd do → Build an internal golden base (registry/base/python:3.12-2026w45) with CA bundles, non-root user, tzdata and agent config. Rebuild weekly, scan, sign and publish. Services FROM it by digest; Renovate bumps the digest.
Why → One place to patch, shared layers on nodes, consistent security posture.
Interview tip → Keep the base thin; a fat shared base becomes a dependency trap.
More on Multi-stage builds, cache, tags and registries
Show a multi-stage Dockerfile for a Java Spring Boot app and explain what you gain.BeginnerCI rebuilds from scratch every run and takes 12 minutes. How do you bring it down?IntermediateYou tag every build `myapp:latest`. A rollback is requested. What happens?BeginnerHow do you promote an image from dev to prod registry without rebuilding?IntermediateDisk on the build server keeps filling up with images.BeginnerWhen do you use `--no-cache` and when is it a smell?Beginner