Class BuildImage

  • All Implemented Interfaces:
    com.bmuschko.gradle.docker.tasks.RegistryCredentialsAware , kotlin.Comparable , org.gradle.api.Named , org.gradle.api.Task , org.gradle.api.internal.DynamicObjectAware , org.gradle.api.internal.TaskInternal , org.gradle.api.plugins.ExtensionAware , org.gradle.util.Configurable

    @DisableCachingByDefault(because = "Builds an image into the local Docker daemon - the resulting image lives outside the build's output directories, so a cache hit would not recreate it") 
    public abstract class BuildImage
    extends AbstractDockerRemoteApiTask implements RegistryCredentialsAware
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      BuildImage(ObjectFactory objectFactory, ProjectLayout projectLayout, FileSystemOperations fsOps)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final ProjectLayout getProjectLayout()
      final Unit setProjectLayout(ProjectLayout value)
      final FileSystemOperations getFsOps()
      final Unit setFsOps(FileSystemOperations value)
      final ConfigurableFileCollection getSrcFiles() Additional files to build the image.
      final RegularFileProperty getDockerfile() The Dockerfile to use to build the image.
      final SetProperty<String> getImages() The images including repository, image name and tag used e.g.
      final Property<Boolean> getNoCache() When {@code true}, do not use docker cache when building the image.
      final Property<Boolean> getRemove() When {@code true}, remove intermediate containers after a successful build.
      final Property<Boolean> getQuiet() When {@code true}, suppress the build output and print image ID on success.
      final Property<Boolean> getPull() When {@code true}, always attempt to pull a newer version of the image.
      final MapProperty<String, String> getLabels() Labels to attach as metadata for to the image.
      final Property<String> getNetwork() Networking mode for the RUN instructions during build.
      final MapProperty<String, String> getBuildArgs() Build-time variables to pass to the image build.
      final SetProperty<String> getCacheFrom() Images to consider as cache sources.
      final Property<Long> getShmSize() Size of {@code /dev/shm} in bytes.
      final Property<String> getTarget() With this parameter it is possible to build a special stage in a multi-stage Docker file.
      final SetProperty<String> getExtraHosts() Build-time additional host list to pass to the image build in the format {@code host:ip}.
      final RegularFileProperty getImageFile() Output file containing the image ID of the built image.
      final Property<String> getImageId() The id of the image built.
      final Property<String> getDirname()
      final Property<Boolean> getEnabled()
      Unit registryCredentials(Action<in DockerRegistryCredentials> action) Configures the target Docker registry credentials for use with a task.
      DockerRegistryCredentials getRegistryCredentials() The target Docker registry credentials for usage with a task.
      Unit runRemoteCommand()
      • Methods inherited from class com.intershop.gradle.icm.docker.tasks.BuildImage

        getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getRegistryCredentials, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, setActions, setDescription, setDidWork, setEnabled, setEnabled, setGroup
      • Methods inherited from class com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask

        getApiVersion, getCertPath, getDockerClient, getDockerClientService, getUrl, onComplete, onError, onNext, start
      • Methods inherited from class org.gradle.api.internal.AbstractTask

        getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getReasonsNotToTrackState, getRequiredServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, setImpliesSubProjects
      • Methods inherited from class org.gradle.api.Task

        configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, doNotTrackState, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, notCompatibleWithConfigurationCache, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
      • Methods inherited from class org.gradle.api.Named

        getName
      • Methods inherited from class kotlin.Comparable

        compareTo
      • Methods inherited from class org.gradle.api.plugins.ExtensionAware

        getExtensions
      • Methods inherited from class org.gradle.api.internal.TaskInternal

        acceptServiceReferences, appendParallelSafeAction, doNotTrackStateIf, hasTaskActions, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BuildImage

        BuildImage(ObjectFactory objectFactory, ProjectLayout projectLayout, FileSystemOperations fsOps)
    • Method Detail

      • getFsOps

         final FileSystemOperations getFsOps()
      • getSrcFiles

        @InputFiles()@PathSensitive(value = PathSensitivity.RELATIVE) final ConfigurableFileCollection getSrcFiles()

        Additional files to build the image.

      • getDockerfile

        @InputFile()@Optional()@PathSensitive(value = PathSensitivity.RELATIVE) final RegularFileProperty getDockerfile()

        The Dockerfile to use to build the image. If null, will use 'Dockerfile' in the build context, i.e. "Dockerfile" in the srcfiles.

      • getImages

        @Input()@Optional() final SetProperty<String> getImages()

        The images including repository, image name and tag used e.g. {@code vieux/apache:2.0}.

      • getNoCache

        @Input()@Optional() final Property<Boolean> getNoCache()

        When {@code true}, do not use docker cache when building the image.

      • getRemove

        @Input()@Optional() final Property<Boolean> getRemove()

        When {@code true}, remove intermediate containers after a successful build.

      • getQuiet

        @Input()@Optional() final Property<Boolean> getQuiet()

        When {@code true}, suppress the build output and print image ID on success.

      • getPull

        @Input()@Optional() final Property<Boolean> getPull()

        When {@code true}, always attempt to pull a newer version of the image.

      • getLabels

        @Input()@Optional() final MapProperty<String, String> getLabels()

        Labels to attach as metadata for to the image.

      • getNetwork

        @Input()@Optional() final Property<String> getNetwork()

        Networking mode for the RUN instructions during build.

      • getBuildArgs

        @Input()@Optional() final MapProperty<String, String> getBuildArgs()

        Build-time variables to pass to the image build.

      • getCacheFrom

        @Input()@Optional() final SetProperty<String> getCacheFrom()

        Images to consider as cache sources.

      • getShmSize

        @Input()@Optional() final Property<Long> getShmSize()

        Size of {@code /dev/shm} in bytes. The size must be greater than 0. If omitted the system uses 64MB.

      • getTarget

        @Input()@Optional() final Property<String> getTarget()

        With this parameter it is possible to build a special stage in a multi-stage Docker file.

        <p> This feature is only available for use with Docker 17.05 and higher.
      • getExtraHosts

        @Input()@Optional() final SetProperty<String> getExtraHosts()

        Build-time additional host list to pass to the image build in the format {@code host:ip}.

      • getImageFile

        @OutputFile() final RegularFileProperty getImageFile()

        Output file containing the image ID of the built image. Defaults to "

        $buildDir/.docker/$

        taskpath-imageId.txt". If path contains ':' it will be replaced by '_'.

      • registryCredentials

         Unit registryCredentials(Action<in DockerRegistryCredentials> action)

        Configures the target Docker registry credentials for use with a task.

      • getRegistryCredentials

         DockerRegistryCredentials getRegistryCredentials()

        The target Docker registry credentials for usage with a task.