Closed cmoulliard closed 3 weeks ago
The fluent DSL allows to declare such a volume at the condition that a podman's volume has been created but how can we tell to podman or the buildpack client = lifecycle which uses java docker lib to bind $HOME/.m2
with the volume ?
int exitCode = BuildConfig.builder()
.withNewBuildCacheConfig()
.withCacheVolumeName("~/.m2")
.endBuildCacheConfig()
The build cache is a buildpacks artifact, controlled by the buildpacks spec. It's not a generic cache volume you can mount arbitrary content via. The cache volume name is not a system path, but the volume name used with docker, you do not get to pick paths for the cache volume, it is supplied to the lifecycle, to be used to store buildpack layers marked for caching. Supplying the same cache volume for a subsequent build of the same project will then allow those layers to be reinflated and reused.. (if the buildpacks that created them understand how to do that).
The snowdrop buildpack library does not expose any way to perform bind mounts from the local filesystem into a buildpack build. This would be required to mount a maven cache, however, previous investigations from other containerised build tooling such as odo and appsody discoverd that the m2 cache directory is in no way safe to use concurrently, and that bind mounting it for containerised builds risks corrupting the cache if concurrent writes are made for the same dependencies.
Adding the functionality would not be difficult, it would require new configuration to allow src:dest paths to be specified, and then extra code to mount the specified volume(s) for each phase.
Question
Can we mount a local maven repository as we can do with Pack CLI ?
@BarDweller