Predict the rebuild
A Dockerfile and one stated edit. Mark each instruction as cached or rebuilt before anything runs. Then it runs.
The Dockerfile everybody writes first
One line changes in one source file. Mark every instruction you think will run again.
The editedit src/routes.js
- 1
FROM alpine:3.22 - 2
WORKDIR /app - 3
COPY . . - 4
RUN npm ci - 5
RUN npm run build - 6
CMD ["node", "src/server.js"]
Nothing has run
Mark every instruction, then build. The ledger, the layers and the reasons appear together — not before.