Caching dependency compilation in Docker build

Whoever is coming now.
I have an umbrella app. Just mix.exs and mix.lock file copying won’t allow me to get all deps. So what I do is copy mix.exs from all the sub apps and make same structure like umbrella app but for configs of these sub apps I copy umrellas config. Then do

run mix deps.get --all
mix deps.compile

after this

copy apps /build/apps

digest build etc

from this stage onwards it’s always new. Again to be specific my docker file multistaged, so in second stage I install bare minimums are copy stuff from first stage