September 2018
Intermediate to advanced
764 pages
20h 6m
English
At the moment, we are copying our entire application code, installing its dependencies, and then building the application.
But what if I make changes to my application code, but do not introduce any new dependencies? In our current approach, we’d have to run all three steps again, and the RUN ["yarn"] step is likely going to take a long time as it has to download thousands of files:
COPY --chown=node:node . .RUN ["yarn"]RUN ["yarn", "run", "build"]
Fortunately, Docker implements a clever caching mechanism. Whenever Docker generates an image, it stores the underlying layers in the filesystem. When Docker is asked to build a new image, instead of blindly following the instructions again, Docker will check its existing ...
Read now
Unlock full access