Explain "build once, deploy many". Why is rebuilding per environment an anti-pattern?
IntermediateConceptFundamentals and Pipeline Design
Answer
You build the artifact a single time, tag it with an immutable identifier (commit SHA or image digest), and promote that same artifact through dev, staging and production. Only configuration changes between environments, injected at deploy time (env vars, ConfigMaps, Helm values).
Rebuilding per environment means production runs bits that were never tested, because compilers, dependency resolution or base images may have changed in between. It also makes "it passed in staging" meaningless.
docker build -t registry.example.com/shop/api:${GIT_SHA} .
docker push registry.example.com/shop/api:${GIT_SHA}
# staging and prod deploy the SAME tag; only values files differ
helm upgrade --install api ./chart -f values-prod.yaml --set image.tag=${GIT_SHA}
More on Fundamentals and Pipeline Design
What is Continuous Integration (CI)?BeginnerWhat is the difference between Continuous Delivery and Continuous Deployment?IntermediateWhat is a CI/CD pipeline and what are its stages?BeginnerWhy should a pipeline "fail fast", and how do you order stages to achieve it?IntermediateWhat makes a build reproducible, and why does it matter?AdvancedHow does your branching strategy affect CI? Compare trunk-based development with GitFlow.Intermediate