I have this command in my docker file:
ADD static/ /www/static/
I have noticed that re-running docker build
reuses the cache, even though the contents of the static/
directory have changed. Is this normal?
How does docker decide when a layer needs to be rebuilt? Just by looking at the command that needs to be executed, or by checking the actual operation performed? I assume is the former, since the latter would require re-running the operation, defeating the purpose of caching.
The workaround that I am using now is --no-cache
but this makes building slower, since no layer is reused. Is there a better way?
I think the best option would be to mark one operation as non-cacheable. Is this possible?