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<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, Configurable<Task>

@DisableCachingByDefault public class BootBuildImage extends 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
  • Constructor Details

    • BootBuildImage

      public BootBuildImage()
  • Method Details

    • getArchiveFile

      @Input public 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 Property<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(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(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(Action<DockerSpec> action)
      Configures the Docker connection using the given action.
      Parameters:
      action - the action to apply
      Since:
      2.4.0