makisu icon indicating copy to clipboard operation
makisu copied to clipboard

`COPY --from` always breaks cache

Open apourchet opened this issue 6 years ago • 4 comments

apourchet avatar Nov 27 '18 21:11 apourchet

@apourchet could you please share more details on this issue?

hatemosphere avatar Dec 12 '18 13:12 hatemosphere

Currently cache ID calculation is done before the whole build process. The logic is:

  • For FROM, the ID is hash(makisu_version + base_image_sha)
  • For ADD/COPY without --from, the ID is hash(parent_id + hash(source_content))
  • For COPY with --from, the ID is always random
  • For other steps, the ID is hash(parent_id + string(current_line))

So we intentionally break the cache chain whenever we see COPY --from, because at the time of cache ID calculation, we don't know the hash of the files to be copied. The fix could be simple - move the calculation at the beginning of each stage.

yiranwang52 avatar Dec 12 '18 13:12 yiranwang52

I have the same problem. Any ETA for a fix ?

bpaquet avatar Jul 02 '19 22:07 bpaquet

We will work on this in Q3.

yiranwang52 avatar Jul 09 '19 18:07 yiranwang52