When should you build images in CI versus on the production host?
BeginnerProductionArchitecture & Design Decisions
Answer
Always build in CI and pull the immutable image on hosts. Building on prod hosts needs compilers and source code there, is unrepeatable, consumes production CPU/disk, and bypasses scanning/signing. The exception is a hobby single-VM project, and even then a registry pull is a small step up.
More on Architecture & Design Decisions
How would you design a container build-and-deploy pipeline from commit to production?AdvancedWhen should you use Docker Compose, Swarm, ECS, or Kubernetes?IntermediateHow do you decide how many processes belong in one container?BeginnerHow do you design the config strategy for containerized apps (12-factor)?IntermediateHow would you containerize a legacy app that writes to local disk and holds sessions in memory?AdvancedAlpine or Debian-slim for a Python service?Intermediate