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
-
-
Field Summary
Fields Modifier and Type Field Description private ProjectLayoutprojectLayoutprivate FileSystemOperationsfsOpsprivate final ConfigurableFileCollectionsrcFilesprivate final RegularFilePropertydockerfileprivate final SetProperty<String>imagesprivate final Property<Boolean>noCacheprivate final Property<Boolean>removeprivate final Property<Boolean>quietprivate final Property<Boolean>pullprivate final MapProperty<String, String>labelsprivate final Property<String>networkprivate final MapProperty<String, String>buildArgsprivate final SetProperty<String>cacheFromprivate final Property<Long>shmSizeprivate final Property<String>targetprivate final SetProperty<String>extraHostsprivate final RegularFilePropertyimageFileprivate final Property<String>imageIdprivate final Property<String>dirnameprivate final Property<Boolean>enabledprivate final TaskOutputsInternaloutputsprivate final Property<String>apiVersionprivate final Spec<in TaskInternal>onlyIfprivate final Property<Duration>timeoutprivate final TaskRequiredServicesrequiredServicesprivate final TaskDependencyInternaltaskDependenciesprivate final Set<Object>dependsOnprivate final TaskDestroyablesdestroyablesprivate final Loggerloggerprivate final Stringpathprivate final Factory<File>temporaryDirFactoryprivate final Optional<String>reasonTaskIsIncompatibleWithConfigurationCacheprivate final TaskLocalStatelocalStateprivate final List<InputChangesAwareTaskAction>taskActionsprivate final TaskDependencyInternallifecycleDependenciesprivate BooleanisEnabledprivate BooleanimpliesSubProjectsprivate final TaskInputsInternalinputsprivate Booleanenabledprivate final TaskStateInternalstateprivate final Property<String>urlprivate final TaskIdentity<?>taskIdentityprivate final TaskDependencyshouldRunAfterprivate final ExtensionContainerextensionsprivate final BooleanisCompatibleWithConfigurationCacheprivate final TaskDependencyfinalizedByprivate final AntBuilderantprivate final DynamicObjectasDynamicObjectprivate final List<ResourceLock>sharedResourcesprivate BooleandidWorkprivate final Property<DockerClientService>dockerClientServiceprivate final Optional<String>reasonNotToTrackStateprivate Stringgroupprivate final Set<String>reasonsNotToTrackStateprivate final DockerRegistryCredentialsregistryCredentialsprivate final BooleanisHasCustomActionsprivate List<Action<in Task>>actionsprivate final DirectoryPropertycertPathprivate final Stringnameprivate final FiletemporaryDirprivate final LoggingManagerloggingprivate final PathidentityPathprivate final DockerClientdockerClientprivate final TaskDependencymustRunAfterprivate final StandardOutputCapturestandardOutputCaptureprivate final Projectprojectprivate Stringdescription
-
Constructor Summary
Constructors Constructor Description BuildImage(ObjectFactory objectFactory, ProjectLayout projectLayout, FileSystemOperations fsOps)
-
Method Summary
Modifier and Type Method Description final ProjectLayoutgetProjectLayout()final UnitsetProjectLayout(ProjectLayout value)final FileSystemOperationsgetFsOps()final UnitsetFsOps(FileSystemOperations value)final ConfigurableFileCollectiongetSrcFiles()Additional files to build the image. final RegularFilePropertygetDockerfile()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 RegularFilePropertygetImageFile()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()UnitregistryCredentials(Action<in DockerRegistryCredentials> action)Configures the target Docker registry credentials for use with a task. DockerRegistryCredentialsgetRegistryCredentials()The target Docker registry credentials for usage with a task. UnitrunRemoteCommand()-
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
-
-
Method Detail
-
getProjectLayout
final ProjectLayout getProjectLayout()
-
setProjectLayout
final Unit setProjectLayout(ProjectLayout value)
-
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 '_'.
-
getImageId
final Property<String> getImageId()
The id of the image built.
-
getDirname
@Input() final Property<String> getDirname()
-
getEnabled
@Internal() final Property<Boolean> getEnabled()
-
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.
-
runRemoteCommand
Unit runRemoteCommand()
-
-
-
-