Package 

Class BuildImage

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

    
    public class BuildImage
    extends AbstractDockerRemoteApiTask implements RegistryCredentialsAware
                        
    • Constructor Summary

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

      Modifier and Type Method Description
      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()
      final ProjectLayout getProjectLayout()
      final Unit setProjectLayout(@Internal() ProjectLayout projectLayout)
      final FileSystemOperations getFsOps()
      final Unit setFsOps(@Internal() FileSystemOperations fsOps)
      DockerRegistryCredentials getRegistryCredentials() The target Docker registry credentials for usage with a task.
      Unit registryCredentials(Action<in DockerRegistryCredentials> action) Configures the target Docker registry credentials for use with a task.
      Unit runRemoteCommand()
      • Methods inherited from class com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask

        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, getProperty, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, invokeMethod, 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.DefaultTask

        appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects
      • Methods inherited from class com.intershop.gradle.icm.docker.tasks.BuildImage

        getApiVersion, getCertPath, getDockerClient, getMetaClass, getNextHandler, getRegistryAuthLocator, getUrl, memoizedMethodPriv$getDockerClient, memoizedMethodPriv$getRegistryAuthLocator, onComplete, onError, onNext, setMetaClass, start
      • 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

      • getSrcFiles

        @InputFiles() final ConfigurableFileCollection getSrcFiles()

        Additional files to build the image.

      • getDockerfile

        @InputFile()@Optional() 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 '_'.

      • getFsOps

         final FileSystemOperations getFsOps()
      • setFsOps

         final Unit setFsOps(@Internal() FileSystemOperations fsOps)
      • getRegistryCredentials

         DockerRegistryCredentials getRegistryCredentials()

        The target Docker registry credentials for usage with a task.

      • registryCredentials

         Unit registryCredentials(Action<in DockerRegistryCredentials> action)

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