Ok, one of the possible ways to solve this is to add a minimal required .gradle content into the slave images. From a little experiment, I can see it will add about 100MB (about 50MB is just the wrapper) to an image, but it will nullify the need to download all the plugins on every new build, saving the time and bandwidth.
There a couple of issues with it:
- the cache needs to be rebuild every time the slave image is built to make sure we aren't missing any important updates like version of the gradle being bumped up, or an explicit plugin is upgraded.
- we need to figure out where to put this cache. It can set in to somewhere like /usr/share/gradle.home. Add the setting of GRADLE_USER_HOME pointing to that location to the /etc/profiles.d/bigtop.sh so the build is picking up the cache from the correct location. Alternatively, gradle can be run with -g option to achieve the same.
Running something like gradle tasks is enough to refill the cache.
I am not sure how to do the better in the docker creation process. Perhaps, we can do something like this:
- gradle -g /tmp/gradle.shared
Then inside of a docker file add
- COPY /tmp/gradle.shared /usr/share
The first step only need to be executed once for all docker image builds. Does it sound right? Olaf Flebbe, Evans Ye - any input?