I've seen similar questions to this but for maven rather than gradle. I use kaniko caching of docker containers and I could massively improve cache hits if I could separate out the dependencies from the application, since the dependencies don't change very often. I'm looking for either some way to build the dependencies jar or alternatively a way to build a Dockerfile that individually copies across the jar files (kaniko uses the Dockerfile and caches each command separately.
Asked
Active
Viewed 296 times
1
-
You can create a multi-stage docker build and always put the part that does not change often at the top of each stage. This will make the caching mechanism work in an optimal way. But this is not specific to gradle. – Davide Madrisan Sep 24 '21 at 19:18
-
1I discovered https://github.com/GoogleContainerTools/jib which covers my use case exactly – shmish111 Oct 14 '21 at 15:48