Compile time volume binding


I would like to know if there is a way to have some “volume binding” (should we say) at compile time?
This, in order to have some cache on artifacts. Eg. with maven in order not to re-download every common package between builds… In this case a .m2 folder could be mounted/shared/bind in order to use already download packages by the previous build.
This may also be usefull with other artifacts/dependencies manager like pip/npm… all dependencies systems with cached artifacts.

This may greatly reduced compilation time and bandwidth during builds.

Thank you for your amazing work all! :slight_smile:

You should be able to take advantage of HAB_DOCKER_OPTS environment var.

$ HAB_DOCKER_OPTS="-v /path/to/m2:~/.m2" hab build
# or 
HAB_DOCKER_OPTS="-v /path/to/m2:~/.m2" hab studio enter

@bdangit This implies using habitat in a docker environment, which is not needed with linux :wink:

@jlebloas I’m not sure if there’s an easy way to do this with non-Docker Studios right now. @fnichol will know for sure, though.

It seems that the recently introduced cacher may solve this issue IINM

You might need to do a PR into cacher to add maven support