You need to run integration tests against the exact image you will ship.
IntermediateScenarioMulti-stage builds, cache, tags and registries
Answer
Situation read → Testing a different build than the one released defeats the purpose.
What I'd do →
- Build once and load:
docker buildx build --load -t app:$SHA .. - Start dependencies with Compose, run tests against
app:$SHA(Testcontainers ordocker compose up --wait). - Push that same digest only if tests pass.
Why → Promote the artefact, not the source.
Interview tip → docker compose up --wait blocks until health checks pass.
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