Class BootBuildImage
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.springframework.boot.gradle.tasks.bundling.BootBuildImage
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>
,org.gradle.api.internal.DynamicObjectAware
,org.gradle.api.internal.TaskInternal
,org.gradle.api.plugins.ExtensionAware
,org.gradle.api.Task
,org.gradle.util.Configurable<org.gradle.api.Task>
@DisableCachingByDefault
public class BootBuildImage
extends org.gradle.api.DefaultTask
A
Task
for bundling an application into an OCI image using a
buildpack.- Since:
- 2.3.0
- Author:
- Andy Wilkinson, Scott Frederick, Rafael Ceccone, Jeroen Meijer, Julian Liebig
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.Namer
-
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an entry to the volume bindings that will be mounted to the container when building the image.void
Add entries to the volume bindings that will be mounted to the container when building the image.void
buildCache
(org.gradle.api.Action<CacheSpec> action) Customizes theCacheSpec
for the build cache using the givenaction
.void
Add an entry to the buildpacks that will be used when building the image.void
buildpacks
(List<String> buildpacks) Adds entries to the buildpacks that will be used when building the image.void
docker
(org.gradle.api.Action<DockerSpec> action) Configures the Docker connection using the givenaction
.void
environment
(String name, String value) Add an entry to the environment that will be used when building the image.void
environment
(Map<String, String> entries) Adds entries to the environment that will be used when building the image.org.gradle.api.file.RegularFileProperty
Returns the property for the archive file from which the image will be built.Returns the volume bindings that will be mounted to the container when building the image.Returns the build cache that will be used when building the image.Returns the builder that will be used to build the image.Returns the buildpacks that will be used when building the image.Returns the Docker configuration the builder will use.Returns the environment that will be used when building the image.Returns the name of the image that will be built.Returns the launch cache that will be used when building the image.Returns the network the build container will connect to.org.springframework.boot.buildpack.platform.build.PullPolicy
Returns image pull policy that will be used when building the image.Returns the run image that will be included in the built image.getTags()
Returns the tags that will be created for the built image.org.gradle.api.provider.Property<org.gradle.api.JavaVersion>
Returns the target Java version of the project (e.g.boolean
Returns whether caches should be cleaned before packaging.boolean
Whether the built image should be pushed to a registry.boolean
Whether verbose logging should be enabled while building the image.void
launchCache
(org.gradle.api.Action<CacheSpec> action) Customizes theCacheSpec
for the launch cache using the givenaction
.void
setBindings
(List<String> bindings) Sets the volume bindings that will be mounted to the container when building the image.void
setBuilder
(String builder) Sets the builder that will be used to build the image.void
setBuildpacks
(List<String> buildpacks) Sets the buildpacks that will be used when building the image.void
setCleanCache
(boolean cleanCache) Sets whether caches should be cleaned before packaging.void
setEnvironment
(Map<String, String> environment) Sets the environment that will be used when building the image.void
setImageName
(String imageName) Sets the name of the image that will be built.void
setNetwork
(String network) Sets the network the build container will connect to.void
setPublish
(boolean publish) Sets whether the built image should be pushed to a registry.void
setPullPolicy
(org.springframework.boot.buildpack.platform.build.PullPolicy pullPolicy) Sets image pull policy that will be used when building the image.void
setRunImage
(String runImage) Sets the run image that will be included in the built image.void
Sets the tags that will be created for the built image.void
setVerboseLogging
(boolean verboseLogging) Sets whether verbose logging should be enabled while building the image.void
Add an entry to the tags that will be created for the built image.void
Add entries to the tags that will be created for the built image.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
Methods inherited from class org.gradle.api.internal.AbstractTask
appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gradle.api.Task
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
-
Constructor Details
-
BootBuildImage
public BootBuildImage()
-
-
Method Details
-
getArchiveFile
@Input public org.gradle.api.file.RegularFileProperty getArchiveFile()Returns the property for the archive file from which the image will be built.- Returns:
- the archive file property
-
getTargetJavaVersion
@Input @Optional public org.gradle.api.provider.Property<org.gradle.api.JavaVersion> getTargetJavaVersion()Returns the target Java version of the project (e.g. as provided by thetargetCompatibility
build property).- Returns:
- the target Java version
-
getImageName
Returns the name of the image that will be built. Whennull
, the name will be derived from theProject's
name
andversion
.- Returns:
- name of the image
-
setImageName
Sets the name of the image that will be built.- Parameters:
imageName
- name of the image
-
getBuilder
Returns the builder that will be used to build the image. Whennull
, the default builder will be used.- Returns:
- the builder
-
setBuilder
Sets the builder that will be used to build the image.- Parameters:
builder
- the builder
-
getRunImage
Returns the run image that will be included in the built image. Whennull
, the run image bundled with the builder will be used.- Returns:
- the run image
-
setRunImage
Sets the run image that will be included in the built image.- Parameters:
runImage
- the run image
-
getEnvironment
Returns the environment that will be used when building the image.- Returns:
- the environment
-
setEnvironment
Sets the environment that will be used when building the image.- Parameters:
environment
- the environment
-
environment
Add an entry to the environment that will be used when building the image.- Parameters:
name
- the name of the entryvalue
- the value of the entry
-
environment
Adds entries to the environment that will be used when building the image.- Parameters:
entries
- the entries to add to the environment
-
isCleanCache
@Input public boolean isCleanCache()Returns whether caches should be cleaned before packaging.- Returns:
- whether caches should be cleaned
-
setCleanCache
public void setCleanCache(boolean cleanCache) Sets whether caches should be cleaned before packaging.- Parameters:
cleanCache
-true
to clean the cache, otherwisefalse
.
-
isVerboseLogging
@Input public boolean isVerboseLogging()Whether verbose logging should be enabled while building the image.- Returns:
- whether verbose logging should be enabled
-
setVerboseLogging
public void setVerboseLogging(boolean verboseLogging) Sets whether verbose logging should be enabled while building the image.- Parameters:
verboseLogging
-true
to enable verbose logging, otherwisefalse
.
-
getPullPolicy
@Input @Optional public org.springframework.boot.buildpack.platform.build.PullPolicy getPullPolicy()Returns image pull policy that will be used when building the image.- Returns:
- whether images should be pulled
-
setPullPolicy
public void setPullPolicy(org.springframework.boot.buildpack.platform.build.PullPolicy pullPolicy) Sets image pull policy that will be used when building the image.- Parameters:
pullPolicy
- image pull policyPullPolicy
-
isPublish
@Input public boolean isPublish()Whether the built image should be pushed to a registry.- Returns:
- whether the built image should be pushed
-
setPublish
public void setPublish(boolean publish) Sets whether the built image should be pushed to a registry.- Parameters:
publish
-true
the push the built image to a registry.false
.
-
getBuildpacks
Returns the buildpacks that will be used when building the image.- Returns:
- the buildpack references
-
setBuildpacks
Sets the buildpacks that will be used when building the image.- Parameters:
buildpacks
- the buildpack references
-
buildpack
Add an entry to the buildpacks that will be used when building the image.- Parameters:
buildpack
- the buildpack reference
-
buildpacks
Adds entries to the buildpacks that will be used when building the image.- Parameters:
buildpacks
- the buildpack references
-
getBindings
Returns the volume bindings that will be mounted to the container when building the image.- Returns:
- the bindings
-
setBindings
Sets the volume bindings that will be mounted to the container when building the image.- Parameters:
bindings
- the bindings
-
binding
Add an entry to the volume bindings that will be mounted to the container when building the image.- Parameters:
binding
- the binding
-
bindings
Add entries to the volume bindings that will be mounted to the container when building the image.- Parameters:
bindings
- the bindings
-
getTags
Returns the tags that will be created for the built image.- Returns:
- the tags
-
setTags
Sets the tags that will be created for the built image.- Parameters:
tags
- the tags
-
tag
Add an entry to the tags that will be created for the built image.- Parameters:
tag
- the tag
-
tags
Add entries to the tags that will be created for the built image.- Parameters:
tags
- the tags
-
getNetwork
Returns the network the build container will connect to.- Returns:
- the network
-
setNetwork
Sets the network the build container will connect to.- Parameters:
network
- the network
-
getBuildCache
Returns the build cache that will be used when building the image.- Returns:
- the cache
-
buildCache
Customizes theCacheSpec
for the build cache using the givenaction
.- Parameters:
action
- the action
-
getLaunchCache
Returns the launch cache that will be used when building the image.- Returns:
- the cache
-
launchCache
Customizes theCacheSpec
for the launch cache using the givenaction
.- Parameters:
action
- the action
-
getDocker
Returns the Docker configuration the builder will use.- Returns:
- docker configuration.
- Since:
- 2.4.0
-
docker
Configures the Docker connection using the givenaction
.- Parameters:
action
- the action to apply- Since:
- 2.4.0
-