- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Workshop: sorting tools by how often you grab them
Trick to keep in mind+3 XP
Slow and stable first, fast and fickle last. Docker rebuilds from the first change downward.
A cached layer is reused only if its own inputs are unchanged and every layer above it was also reused. Once one layer changes, everything after it rebuilds. So order steps by how rarely they change. Dependency manifests change occasionally; your source changes constantly, so it belongs lower down.
COPY package.json package-lock.json ./
RUN npm ci
COPY src ./srcRead it once, then a question tests whether the trick stuck.