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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    binding(String binding)
    Add an entry to the volume bindings that will be mounted to the container when building the image.
    void
    bindings(List<String> bindings)
    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 the CacheSpec for the build cache using the given action.
    void
    buildpack(String buildpack)
    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 given action.
    void
    environment(String name, String value)
    Add an entry to the environment that will be used when building the image.
    void
    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.
    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 the CacheSpec for the launch cache using the given action.
    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
    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
    tag(String tag)
    Add an entry to the tags that will be created for the built image.
    void
    tags(List<String> tags)
    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 the targetCompatibility build property).
      Returns:
      the target Java version
    • getImageName

      @Input @Optional public String getImageName()
      Returns the name of the image that will be built. When null, the name will be derived from the Project's name and version.
      Returns:
      name of the image
    • setImageName

      public void setImageName(String imageName)
      Sets the name of the image that will be built.
      Parameters:
      imageName - name of the image
    • getBuilder

      @Input @Optional public String getBuilder()
      Returns the builder that will be used to build the image. When null, the default builder will be used.
      Returns:
      the builder
    • setBuilder

      public void setBuilder(String builder)
      Sets the builder that will be used to build the image.
      Parameters:
      builder - the builder
    • getRunImage

      @Input @Optional public String getRunImage()
      Returns the run image that will be included in the built image. When null, the run image bundled with the builder will be used.
      Returns:
      the run image
    • setRunImage

      public void setRunImage(String runImage)
      Sets the run image that will be included in the built image.
      Parameters:
      runImage - the run image
    • getEnvironment

      @Input public Map<String,String> getEnvironment()
      Returns the environment that will be used when building the image.
      Returns:
      the environment
    • setEnvironment

      public void setEnvironment(Map<String,String> environment)
      Sets the environment that will be used when building the image.
      Parameters:
      environment - the environment
    • environment

      public void environment(String name, String value)
      Add an entry to the environment that will be used when building the image.
      Parameters:
      name - the name of the entry
      value - the value of the entry
    • environment

      public void environment(Map<String,String> entries)
      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, otherwise false.
    • 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, otherwise false.
    • 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 policy PullPolicy
    • 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

      @Input @Optional public List<String> getBuildpacks()
      Returns the buildpacks that will be used when building the image.
      Returns:
      the buildpack references
    • setBuildpacks

      public void setBuildpacks(List<String> buildpacks)
      Sets the buildpacks that will be used when building the image.
      Parameters:
      buildpacks - the buildpack references
    • buildpack

      public void buildpack(String buildpack)
      Add an entry to the buildpacks that will be used when building the image.
      Parameters:
      buildpack - the buildpack reference
    • buildpacks

      public void buildpacks(List<String> buildpacks)
      Adds entries to the buildpacks that will be used when building the image.
      Parameters:
      buildpacks - the buildpack references
    • getBindings

      @Input @Optional public List<String> getBindings()
      Returns the volume bindings that will be mounted to the container when building the image.
      Returns:
      the bindings
    • setBindings

      public void setBindings(List<String> bindings)
      Sets the volume bindings that will be mounted to the container when building the image.
      Parameters:
      bindings - the bindings
    • binding

      public void binding(String binding)
      Add an entry to the volume bindings that will be mounted to the container when building the image.
      Parameters:
      binding - the binding
    • bindings

      public void bindings(List<String> bindings)
      Add entries to the volume bindings that will be mounted to the container when building the image.
      Parameters:
      bindings - the bindings
    • getTags

      @Input @Optional public List<String> getTags()
      Returns the tags that will be created for the built image.
      Returns:
      the tags
    • setTags

      public void setTags(List<String> tags)
      Sets the tags that will be created for the built image.
      Parameters:
      tags - the tags
    • tag

      public void tag(String tag)
      Add an entry to the tags that will be created for the built image.
      Parameters:
      tag - the tag
    • tags

      public void tags(List<String> tags)
      Add entries to the tags that will be created for the built image.
      Parameters:
      tags - the tags
    • getNetwork

      @Input @Optional public String getNetwork()
      Returns the network the build container will connect to.
      Returns:
      the network
    • setNetwork

      public void setNetwork(String network)
      Sets the network the build container will connect to.
      Parameters:
      network - the network
    • getBuildCache

      @Optional public CacheSpec getBuildCache()
      Returns the build cache that will be used when building the image.
      Returns:
      the cache
    • buildCache

      public void buildCache(org.gradle.api.Action<CacheSpec> action)
      Customizes the CacheSpec for the build cache using the given action.
      Parameters:
      action - the action
    • getLaunchCache

      @Optional public CacheSpec getLaunchCache()
      Returns the launch cache that will be used when building the image.
      Returns:
      the cache
    • launchCache

      public void launchCache(org.gradle.api.Action<CacheSpec> action)
      Customizes the CacheSpec for the launch cache using the given action.
      Parameters:
      action - the action
    • getDocker

      public DockerSpec getDocker()
      Returns the Docker configuration the builder will use.
      Returns:
      docker configuration.
      Since:
      2.4.0
    • docker

      public void docker(org.gradle.api.Action<DockerSpec> action)
      Configures the Docker connection using the given action.
      Parameters:
      action - the action to apply
      Since:
      2.4.0