Class Dockerfile
- java.lang.Object
-
- org.gradle.api.internal.AbstractTask
-
- org.gradle.api.DefaultTask
-
- com.bmuschko.gradle.docker.tasks.image.Dockerfile
-
- All Implemented Interfaces:
Comparable<Task>
,org.gradle.api.internal.DynamicObjectAware
,org.gradle.api.internal.TaskInternal
,ExtensionAware
,Task
,Configurable<Task>
@CacheableTask public class Dockerfile extends DefaultTask
Creates a Dockerfile based on the provided instructions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Dockerfile.AddFileInstruction
Represents aADD
instruction.static class
Dockerfile.ArgInstruction
Represents aARG
instruction.static class
Dockerfile.CommentInstruction
Represents a comment instruction.static class
Dockerfile.CopyFile
Input data for aDockerfile.CopyFileInstruction
.static class
Dockerfile.CopyFileInstruction
Represents aCOPY
instruction.static class
Dockerfile.DefaultCommandInstruction
Represents aCMD
instruction.static class
Dockerfile.EntryPointInstruction
Represents aENTRYPOINT
instruction.static class
Dockerfile.EnvironmentVariableInstruction
Represents aENV
instruction.static class
Dockerfile.ExposePortInstruction
Represents aEXPOSE
instruction.static class
Dockerfile.File
Input data for aDockerfile.AddFileInstruction
orDockerfile.CopyFileInstruction
.static class
Dockerfile.FileInstruction<T extends Dockerfile.File>
An instruction whose value is a Dockerfile.File.static class
Dockerfile.From
Input data for aDockerfile.FromInstruction
.static class
Dockerfile.FromInstruction
Represents aFROM
instruction.static class
Dockerfile.GenericInstruction
An instruction that uses the provided value as-is without any additional formatting.static interface
Dockerfile.Instruction
A representation of an instruction in a Dockerfile.static class
Dockerfile.LabelInstruction
Represents aLABEL
instruction.static class
Dockerfile.MapInstruction
An instruction whose value is a Map.static class
Dockerfile.OnBuildInstruction
Represents aONBUILD
instruction.static class
Dockerfile.RunCommandInstruction
Represents aRUN
instruction.static class
Dockerfile.StringArrayInstruction
An instruction whose value is a String array.static class
Dockerfile.StringCommandInstruction
An instruction whose value is a String.static class
Dockerfile.UserInstruction
Represents aUSER
instruction.static class
Dockerfile.VolumeInstruction
static class
Dockerfile.WorkDirInstruction
Represents aWORKDIR
instruction.-
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 Constructor Description Dockerfile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFile(Dockerfile.File file)
The ADD instruction copies new files, directories or remote file URLs from <src> and adds them to the filesystem of the container at the path <dest>.void
addFile(String src, String dest)
The ADD instruction copies new files, directories or remote file URLs from <src> and adds them to the filesystem of the container at the path <dest>.void
addFile(Provider<Dockerfile.File> provider)
An ADD instruction as Provider.void
arg(String arg)
The ARG instruction defines a variable that users can pass at build-time to the builder.void
arg(Provider<String> provider)
An ARG instruction as Provider.void
copyFile(Dockerfile.CopyFile file)
The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.void
copyFile(String src, String dest)
The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.void
copyFile(Provider<Dockerfile.CopyFile> provider)
A COPY instruction as Provider.void
create()
void
defaultCommand(String... command)
The main purpose of a CMD instruction is to provide defaults for an executing container.void
defaultCommand(Provider<List<String>> provider)
A CMD instruction as Provider.void
entryPoint(String... entryPoint)
An ENTRYPOINT allows you to configure a container that will run as an executable.void
entryPoint(Provider<List<String>> provider)
A ENTRYPOINT as Provider.void
environmentVariable(String key, String value)
The ENV instruction sets the environment variable <key> to the value <value>.void
environmentVariable(Map<String,String> envVars)
A ENV instruction as Map.void
environmentVariable(Provider<Map<String,String>> provider)
A ENV instruction as Provider.void
exposePort(Integer... ports)
The EXPOSE instruction informs Docker that the container will listen on the specified network ports at runtime.void
exposePort(Provider<List<Integer>> provider)
A EXPOSE instruction as Provider.void
from(Dockerfile.From from)
The FROM instruction sets the Base Image for subsequent instructions.void
from(String image)
The FROM instruction sets the Base Image for subsequent instructions.void
from(Provider<Dockerfile.From> provider)
A FROM instruction as Provider.Provider<Directory>
getDestDir()
Returns a provider representing the destination directory containing the Dockerfile.RegularFileProperty
getDestFile()
The destination file representing the Dockerfile.ListProperty<Dockerfile.Instruction>
getInstructions()
Returns all instructions used to generate the Dockerfile.void
instruction(String instruction)
Adds a full instruction as String.void
instruction(Provider<String> provider)
Adds a full instruction as Provider.void
instructionsFromTemplate(File template)
Adds instructions to the Dockerfile from a template file.void
instructionsFromTemplate(String templatePath)
Adds instructions to the Dockerfile from a template file.void
instructionsFromTemplate(Provider<RegularFile> provider)
Adds instructions to the Dockerfile from a template file.void
label(Map<String,String> labels)
The LABEL instruction adds metadata to an image.void
label(Provider<Map<String,String>> provider)
A LABEL instruction as Provider.void
onBuild(String instruction)
The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build.void
onBuild(Provider<String> provider)
A ONBUILD instruction as Provider.void
runCommand(String command)
The RUN instruction will execute any commands in a new layer on top of the current image and commit the results.void
runCommand(Provider<String> provider)
A RUN instruction as Provider.void
user(String user)
The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.void
user(Provider<String> provider)
A USER instruction as Provider.void
volume(String... volume)
The VOLUME instruction will create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers.void
volume(Provider<List<String>> provider)
A VOLUME instruction as Provider.void
workingDir(String dir)
The WORKDIR instruction sets the working directory for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.void
workingDir(Provider<String> provider)
A WORKDIR instruction as Provider.-
Methods 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, usesService
-
Methods 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, setImpliesSubProjects
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gradle.api.Task
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
-
-
-
-
Method Detail
-
getDestFile
@OutputFile public final RegularFileProperty getDestFile()
The destination file representing the Dockerfile. The destination file encourages the conventional file name Dockerfile but allows any arbitrary file name.Defaults to
$buildDir/docker/Dockerfile
.The method
getDestDir()
returns the parent directory of the Dockerfile.
-
getInstructions
public ListProperty<Dockerfile.Instruction> getInstructions()
Returns all instructions used to generate the Dockerfile.- Returns:
- All instructions
-
getDestDir
@Internal public Provider<Directory> getDestDir()
Returns a provider representing the destination directory containing the Dockerfile.- Returns:
- The destination directory containing the Dockerfile
- Since:
- 4.4.0
-
create
public void create() throws IOException
- Throws:
IOException
-
instructionsFromTemplate
public void instructionsFromTemplate(File template) throws IOException
Adds instructions to the Dockerfile from a template file. The template file can have any name.- Parameters:
template
- The template file- Throws:
IOException
- See Also:
instructionsFromTemplate(String)
,instructionsFromTemplate(Provider)
-
instructionsFromTemplate
public void instructionsFromTemplate(String templatePath) throws IOException
Adds instructions to the Dockerfile from a template file. The path can be relative to the project root directory or absolute.- Parameters:
templatePath
- The path to the template file- Throws:
IOException
- See Also:
instructionsFromTemplate(java.io.File)
,instructionsFromTemplate(Provider)
-
instructionsFromTemplate
public void instructionsFromTemplate(Provider<RegularFile> provider) throws IOException
Adds instructions to the Dockerfile from a template file. Currently, the provider is evaluated as soon as the method is called which means that the provider is not evaluated lazily. This behavior might change in the future.- Parameters:
provider
- The provider of the template file- Throws:
IOException
- Since:
- 4.0.0
- See Also:
instructionsFromTemplate(java.io.File)
,instructionsFromTemplate(String)
-
instruction
public void instruction(String instruction)
Adds a full instruction as String.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { instruction('FROM ubuntu:14.04') instruction('LABEL maintainer=benjamin.muschko@gmail.com') }
The produced instructions look as follows:FROM ubuntu:14.04 LABEL maintainer=benjamin.muschko@gmail.com
- Parameters:
instruction
- Instruction as String- See Also:
instruction(Provider)
-
instruction
public void instruction(Provider<String> provider)
Adds a full instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { instruction(project.provider(new Callable<String>() { @Override String call() throws Exception { 'FROM ubuntu:14.04' } })) }
The produced instruction looks as follows:FROM ubuntu:14.04
- Parameters:
provider
- Instruction as Provider- Since:
- 4.0.0
- See Also:
instruction(String)
-
from
public void from(String image)
The FROM instruction sets the Base Image for subsequent instructions.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { from('ubuntu:14.04') }
The produced instruction looks as follows:FROM ubuntu:14.04
- Parameters:
image
- From definition- See Also:
from(From)
,from(Provider)
-
from
public void from(Dockerfile.From from)
The FROM instruction sets the Base Image for subsequent instructions.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { from(new From('ubuntu:14.04')) }
The produced instruction looks as follows:FROM ubuntu:14.04
- Parameters:
from
- From definition- See Also:
from(String)
,from(Provider)
-
from
public void from(Provider<Dockerfile.From> provider)
A FROM instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { from(project.provider(new Callable<Dockerfile.From>() { @Override Dockerfile.From call() throws Exception { new Dockerfile.From('ubuntu:14.04') } })) }
The produced instruction looks as follows:FROM ubuntu:14.04
- Parameters:
provider
- From information as Provider- Since:
- 4.0.0
- See Also:
from(From)
-
arg
public void arg(String arg)
The ARG instruction defines a variable that users can pass at build-time to the builder.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { arg('user1=someuser') }
The produced instruction looks as follows:ARG user1=someuser
- Parameters:
arg
- Argument to pass, possibly with default value.- See Also:
arg(Provider)
-
arg
public void arg(Provider<String> provider)
An ARG instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { arg(project.provider(new Callable<String>() { @Override String call() throws Exception { 'user1=someuser' } })) }
The produced instruction looks as follows:ARG user1=someuser
- Parameters:
provider
- Argument to pass as Provider- Since:
- 4.0.0
- See Also:
arg(String)
-
runCommand
public void runCommand(String command)
The RUN instruction will execute any commands in a new layer on top of the current image and commit the results.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { runCommand('/bin/bash -c echo hello') }
The produced instruction looks as follows:RUN /bin/bash -c echo hello
- Parameters:
command
- Command- See Also:
runCommand(Provider)
-
runCommand
public void runCommand(Provider<String> provider)
A RUN instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { runCommand(project.provider(new Callable<String>() { @Override String call() throws Exception { '/bin/bash -c echo hello' } })) }
The produced instruction looks as follows:RUN /bin/bash -c echo hello
- Parameters:
provider
- Command as Provider- Since:
- 4.0.0
- See Also:
runCommand(String)
-
defaultCommand
public void defaultCommand(String... command)
The main purpose of a CMD instruction is to provide defaults for an executing container.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { defaultCommand('/usr/bin/wc', '--help') }
The produced instruction looks as follows:CMD ["/usr/bin/wc", "--help"]
- Parameters:
command
- Command- See Also:
defaultCommand(Provider)
-
defaultCommand
public void defaultCommand(Provider<List<String>> provider)
A CMD instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { defaultCommand(project.provider(new Callable<List<String>>() { @Override List<String> call() throws Exception { ['/usr/bin/wc', '--help'] } })) }
The produced instruction looks as follows:CMD ["/usr/bin/wc", "--help"]
- Parameters:
provider
- Command as Provider- Since:
- 4.0.0
- See Also:
defaultCommand(String...)
-
exposePort
public void exposePort(Integer... ports)
The EXPOSE instruction informs Docker that the container will listen on the specified network ports at runtime.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { exposePort(8080, 9090) }
The produced instruction looks as follows:EXPOSE 8080 9090
- Parameters:
ports
- Ports- See Also:
exposePort(Provider)
-
exposePort
public void exposePort(Provider<List<Integer>> provider)
A EXPOSE instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { exposePort(project.provider(new Callable<List<Integer>>() { @Override List<Integer> call() throws Exception { [8080, 9090] } })) }
The produced instruction looks as follows:EXPOSE 8080 9090
- Parameters:
provider
- Ports as Provider- Since:
- 4.0.0
- See Also:
exposePort(Integer...)
-
environmentVariable
public void environmentVariable(String key, String value)
The ENV instruction sets the environment variable <key> to the value <value>. This value will be passed to all future RUN instructions.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { environmentVariable('MY_NAME', 'John Doe') }
The produced instruction looks as follows:ENV MY_NAME=John Doe
- Parameters:
key
- Keyvalue
- Value- See Also:
environmentVariable(Map)
,environmentVariable(Provider)
-
environmentVariable
public void environmentVariable(Map<String,String> envVars)
A ENV instruction as Map.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { environmentVariable(['MY_NAME': 'John Doe']) }
The produced instruction looks as follows:ENV MY_NAME=John Doe
- Parameters:
envVars
- Environment variables- See Also:
environmentVariable(String, String)
,environmentVariable(Provider)
-
environmentVariable
public void environmentVariable(Provider<Map<String,String>> provider)
A ENV instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { environmentVariable(project.provider(new Callable<Map<String, String>>() { @Override Map<String, String> call() throws Exception { ['MY_NAME': 'John Doe'] } })) }
The produced instruction looks as follows:ENV MY_NAME=John Doe
- Parameters:
provider
- Environment variables as Provider- Since:
- 4.0.0
- See Also:
environmentVariable(String, String)
,environmentVariable(Map)
-
addFile
public void addFile(String src, String dest)
The ADD instruction copies new files, directories or remote file URLs from <src> and adds them to the filesystem of the container at the path <dest>.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { addFile('test', '/absoluteDir/') }
The produced instruction looks as follows:ADD test /absoluteDir/
- Parameters:
src
- The source pathdest
- The destination path- See Also:
addFile(File)
,addFile(Provider)
-
addFile
public void addFile(Dockerfile.File file)
The ADD instruction copies new files, directories or remote file URLs from <src> and adds them to the filesystem of the container at the path <dest>.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { addFile(new Dockerfile.File('test', '/absoluteDir/')) }
The produced instruction looks as follows:ADD test /absoluteDir/
- Parameters:
file
- Dockerfile.File definition- See Also:
addFile(String, String)
,addFile(Provider)
-
addFile
public void addFile(Provider<Dockerfile.File> provider)
An ADD instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { addFile(project.provider(new Callable<Dockerfile.File>() { @Override Dockerfile.File call() throws Exception { new Dockerfile.File('test', '/absoluteDir/') } })) }
The produced instruction looks as follows:ADD test /absoluteDir/
- Parameters:
provider
- Add instruction as Provider- Since:
- 4.0.0
- See Also:
addFile(String, String)
,addFile(File)
-
copyFile
public void copyFile(String src, String dest)
The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { copyFile('test', '/absoluteDir/') }
The produced instruction looks as follows:COPY test /absoluteDir/
- Parameters:
src
- The source pathdest
- The destination path- See Also:
copyFile(CopyFile)
,copyFile(Provider)
-
copyFile
public void copyFile(Dockerfile.CopyFile file)
The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { copyFile(new Dockerfile.CopyFile('test', '/absoluteDir/')) }
The produced instruction looks as follows:COPY test /absoluteDir/
- Parameters:
file
- CopyFile definition- See Also:
copyFile(String, String)
,copyFile(Provider)
-
copyFile
public void copyFile(Provider<Dockerfile.CopyFile> provider)
A COPY instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { copyFile(project.provider(new Callable<Dockerfile.CopyFile>() { @Override Dockerfile.CopyFile call() throws Exception { new Dockerfile.CopyFile('test', '/absoluteDir/') } })) }
The produced instruction looks as follows:COPY test /absoluteDir/
- Parameters:
provider
- Copy instruction as Provider- Since:
- 4.0.0
- See Also:
copyFile(String, String)
,copyFile(CopyFile)
-
entryPoint
public void entryPoint(String... entryPoint)
An ENTRYPOINT allows you to configure a container that will run as an executable.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { entryPoint('top', '-b') }
The produced instruction looks as follows:ENTRYPOINT ["top", "-b"]
- Parameters:
entryPoint
- Entry point- See Also:
entryPoint(Provider)
-
entryPoint
public void entryPoint(Provider<List<String>> provider)
A ENTRYPOINT as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { entryPoint(project.provider(new Callable<List<String>>() { @Override List<String> call() throws Exception { ['top', '-b'] } })) }
The produced instruction looks as follows:ENTRYPOINT ["top", "-b"]
- Parameters:
provider
- Entry point- Since:
- 4.0.0
- See Also:
entryPoint(String...)
-
volume
public void volume(String... volume)
The VOLUME instruction will create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { volume('/myvol') }
The produced instruction looks as follows:VOLUME ["/myvol"]
- Parameters:
volume
- Volume- See Also:
volume(Provider)
-
volume
public void volume(Provider<List<String>> provider)
A VOLUME instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { volume(project.provider(new Callable<List<String>>() { @Override List<String> call() throws Exception { ['/myvol'] } })) }
The produced instruction looks as follows:VOLUME ["/myvol"]
- Parameters:
provider
- Volume- Since:
- 4.0.0
- See Also:
volume(String...)
-
user
public void user(String user)
The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { user('patrick') }
The produced instruction looks as follows:USER patrick
- Parameters:
user
- User- See Also:
user(Provider)
-
user
public void user(Provider<String> provider)
A USER instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { user(project.provider(new Callable<String>() { @Override String call() throws Exception { 'patrick' } })) }
The produced instruction looks as follows:USER patrick
- Parameters:
provider
- User as Provider- Since:
- 4.0.0
- See Also:
user(String)
-
workingDir
public void workingDir(String dir)
The WORKDIR instruction sets the working directory for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { workingDir('/path/to/workdir') }
The produced instruction looks as follows:WORKDIR /path/to/workdir
- Parameters:
dir
- Directory- See Also:
workingDir(Provider)
-
workingDir
public void workingDir(Provider<String> provider)
A WORKDIR instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { workingDir(project.provider(new Callable<String>() { @Override String call() throws Exception { '/path/to/workdir' } })) }
The produced instruction looks as follows:WORKDIR /path/to/workdir
- Parameters:
provider
- Directory- Since:
- 4.0.0
- See Also:
workingDir(String)
-
onBuild
public void onBuild(String instruction)
The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { onBuild('ADD . /app/src') }
The produced instruction looks as follows:ONBUILD ADD . /app/src
- Parameters:
instruction
- Instruction- See Also:
onBuild(Provider)
-
onBuild
public void onBuild(Provider<String> provider)
A ONBUILD instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { onBuild(project.provider(new Callable<String>() { @Override String call() throws Exception { 'ADD . /app/src' } })) }
The produced instruction looks as follows:ONBUILD ADD . /app/src
- Parameters:
provider
- Instruction- Since:
- 4.0.0
- See Also:
onBuild(String)
-
label
public void label(Map<String,String> labels)
The LABEL instruction adds metadata to an image.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { label(['version': '1.0']) }
The produced instruction looks as follows:LABEL version=1.0
- Parameters:
labels
- Labels- See Also:
label(Provider)
-
label
public void label(Provider<Map<String,String>> provider)
A LABEL instruction as Provider.Example in Groovy DSL:
task createDockerfile(type: Dockerfile) { label(project.provider(new Callable<Map<String, String>>() { @Override Map<String, String> call() throws Exception { ['version': '1.0'] } })) }
The produced instruction looks as follows:LABEL version=1.0
- Parameters:
provider
- Labels as Provider- Since:
- 4.0.0
- See Also:
label(Map)
-
-