IBM / container-service-getting-started-wt

Other
95 stars 212 forks source link

Alter Dockerfiles layers ordering to cache deps #104

Open pavanetti opened 5 years ago

hintcnuie commented 4 years ago

I find some explanation around this: Tip #1: Order matters for caching

ef41db8f-fe5e-4a78-940a-6a929db7929d-1

However, the order of the build steps (Dockerfile instructions) matters, because when a step’s cache is invalidated by changing files or modifying lines in the Dockerfile, subsequent steps of their cache will break. Order your steps from least to most frequently changing steps to optimize caching.

link: https://www.docker.com/blog/intro-guide-to-dockerfile-best-practices/

One thing more, could you please give more data on how these changes are useful for the cache deps?