Add bindings option for image building
This commit adds configuration to the Maven and Gradle plugins to allow a list of volume mount bindings to be provided to the image building goal and task. This enables service bindings to be mounted in the builder image that are recognized by buildpacks to support custom certificates, build tool configuration, APM integration, and other buildpack features. Fixes gh-23518
This commit is contained in:
@@ -26,6 +26,7 @@ import org.apache.maven.artifact.Artifact;
|
||||
import org.springframework.boot.buildpack.platform.build.BuildRequest;
|
||||
import org.springframework.boot.buildpack.platform.build.BuildpackReference;
|
||||
import org.springframework.boot.buildpack.platform.build.PullPolicy;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.Binding;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageName;
|
||||
import org.springframework.boot.buildpack.platform.docker.type.ImageReference;
|
||||
import org.springframework.boot.buildpack.platform.io.Owner;
|
||||
@@ -59,6 +60,8 @@ public class Image {
|
||||
|
||||
List<String> buildpacks;
|
||||
|
||||
List<String> bindings;
|
||||
|
||||
/**
|
||||
* The name of the created image.
|
||||
* @return the image name
|
||||
@@ -183,6 +186,9 @@ public class Image {
|
||||
request = request
|
||||
.withBuildpacks(this.buildpacks.stream().map(BuildpackReference::of).collect(Collectors.toList()));
|
||||
}
|
||||
if (this.bindings != null && !this.bindings.isEmpty()) {
|
||||
request = request.withBindings(this.bindings.stream().map(Binding::of).collect(Collectors.toList()));
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user