Class DockerBuildImage
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask
com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
- All Implemented Interfaces:
RegistryCredentialsAware,Comparable<Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,ExtensionAware,Task,Configurable<Task>
public class DockerBuildImage
extends AbstractDockerRemoteApiTask
implements RegistryCredentialsAware
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
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 -
Method Summary
Modifier and TypeMethodDescriptionfinal MapProperty<String,String> Build-time variables to pass to the image build.final SetProperty<String>Images to consider as cache sources.final RegularFilePropertyThe Dockerfile to use to build the image.final SetProperty<String>Build-time additional host list to pass to the image build in the formathost:ip.The ID of the image built.final RegularFilePropertyOutput file containing the image ID of the built image.final SetProperty<String>The images including repository, image name and tag to be built e.g.final DirectoryPropertyInput directory containing the build context.Labels to attach as metadata for to the image.Memory allocated for build specified in bytes (no suffix is needed)Networking mode for the RUN instructions during build.Whentrue, do not use docker cache when building the image.The target platform in the formatos[/arch[/variant]], for examplelinux/s390xordarwin.getPull()Whentrue, always attempt to pull a newer version of the image.getQuiet()Whentrue, suppress the build output and print image ID on success.The target Docker registry credentials for usage with a task.Whentrue, remove intermediate containers after a successful build.Size of/dev/shmin bytes.With this parameter it is possible to build a special stage in a multi-stage Docker file.voidregistryCredentials(Action<? super DockerRegistryCredentials> action) Configures the target Docker registry credentials for use with a task.voidMethods inherited from class com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask
getApiVersion, getCertPath, getDockerClient, getDockerClientService, getNextHandler, getRegistryAuthLocator, getUrl, onComplete, onError, onNext, startMethods 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, usesServiceMethods 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, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.gradle.api.plugins.ExtensionAware
getExtensionsMethods inherited from interface org.gradle.api.Task
configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, doNotTrackState, finalizedBy, getActions, getAnt, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getFinalizedBy, getGroup, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getPath, getProject, getShouldRunAfter, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, notCompatibleWithConfigurationCache, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
-
Constructor Details
-
DockerBuildImage
public DockerBuildImage()
-
-
Method Details
-
getInputDir
Input directory containing the build context. Defaults to "$buildDir/docker". -
getDockerFile
The Dockerfile to use to build the image. If null, will use 'Dockerfile' in the build context, i.e. "$inputDir/Dockerfile". -
getImages
The images including repository, image name and tag to be built e.g.vieux/apache:2.0.- Since:
- 6.0.0
-
getNoCache
Whentrue, do not use docker cache when building the image. -
getRemove
Whentrue, remove intermediate containers after a successful build. -
getQuiet
Whentrue, suppress the build output and print image ID on success. -
getPull
Whentrue, always attempt to pull a newer version of the image. -
getLabels
Labels to attach as metadata for to the image.This property is not final to allow build authors to remove the labels from the up-to-date check by extending
DockerBuildImageand annotating the overridedgetLabels()method with@Internal, example:import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage class CustomDockerBuildImage extends DockerBuildImage { @Override @Internal MapProperty<String, String> getLabels() { super.getLabels() } }A use case for excluding the labels from the up-to-date check is if build author wants to set build information as labels (date, version-control-revision).
-
getNetwork
Networking mode for the RUN instructions during build. -
getBuildArgs
Build-time variables to pass to the image build. -
getCacheFrom
Images to consider as cache sources. -
getShmSize
Size of/dev/shmin bytes. The size must be greater than 0. If omitted the system uses 64MB. -
getMemory
Memory allocated for build specified in bytes (no suffix is needed)- Since:
- 7.3.0
-
getTarget
With this parameter it is possible to build a special stage in a multi-stage Docker file.This feature is only available for use with Docker 17.05 and higher.
- Since:
- 4.10.0
-
getExtraHosts
Build-time additional host list to pass to the image build in the formathost:ip.- Since:
- 6.2.0
-
getPlatform
The target platform in the formatos[/arch[/variant]], for examplelinux/s390xordarwin.- Since:
- 7.1.0
-
getRegistryCredentials
The target Docker registry credentials for usage with a task.- Specified by:
getRegistryCredentialsin interfaceRegistryCredentialsAware
-
getImageIdFile
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 '_'.- Since:
- 4.9.0
-
getImageId
The ID of the image built. The value of this property requires the task action to be executed. -
runRemoteCommand
- Specified by:
runRemoteCommandin classAbstractDockerRemoteApiTask- Throws:
Exception
-
registryCredentials
Configures the target Docker registry credentials for use with a task.- Specified by:
registryCredentialsin interfaceRegistryCredentialsAware- Parameters:
action- The action against the Docker registry credentials
-