Package io.micronaut.gradle.docker
Class NativeImageDockerfile
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.bmuschko.gradle.docker.tasks.image.Dockerfile
io.micronaut.gradle.docker.NativeImageDockerfile
- All Implemented Interfaces:
DockerBuildOptions,Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
public abstract class NativeImageDockerfile
extends com.bmuschko.gradle.docker.tasks.image.Dockerfile
implements DockerBuildOptions
Specialization of
Dockerfile for building native images.- Since:
- 1.0.0
- Author:
- gkrocher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classNested classes/interfaces inherited from class com.bmuschko.gradle.docker.tasks.image.Dockerfile
com.bmuschko.gradle.docker.tasks.image.Dockerfile.AddFileInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.ArgInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.CommentInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.CopyFile, com.bmuschko.gradle.docker.tasks.image.Dockerfile.CopyFileInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.DefaultCommandInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.EntryPointInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.EnvironmentVariableInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.ExposePortInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.File, com.bmuschko.gradle.docker.tasks.image.Dockerfile.FileInstruction<T extends com.bmuschko.gradle.docker.tasks.image.Dockerfile.File>, com.bmuschko.gradle.docker.tasks.image.Dockerfile.From, com.bmuschko.gradle.docker.tasks.image.Dockerfile.FromInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.GenericInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.Healthcheck, com.bmuschko.gradle.docker.tasks.image.Dockerfile.HealthcheckInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.Instruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.LabelInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.MapInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.OnBuildInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.RunCommandInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.StringArrayInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.StringCommandInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.UserInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.VolumeInstruction, com.bmuschko.gradle.docker.tasks.image.Dockerfile.WorkDirInstructionNested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.Namer -
Field Summary
FieldsFields 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 TypeMethodDescriptionAdds additional args to pass to the native image executable.The base image to use.buildActualCommandLine(org.gradle.api.provider.Provider<String> executable, DockerBuildStrategy buildStrategy, NativeImageDockerfile.BaseImageForBuildStrategyResolver imageResolver) voidcreate()exportPorts(Integer... ports) abstract org.gradle.api.provider.ListProperty<String>getArgs()abstract org.gradle.api.provider.Property<String>abstract org.gradle.api.provider.Property<DockerBuildStrategy>abstract org.gradle.api.provider.Property<String>abstract org.gradle.api.provider.ListProperty<Integer>abstract org.gradle.api.provider.Property<String>abstract org.gradle.api.provider.Property<String>abstract org.gradle.api.provider.Property<String>abstract org.gradle.api.provider.Property<String>Return the full URL of the GraalVM distribution to use.abstract org.gradle.jvm.toolchain.JavaToolchainServiceabstract org.gradle.api.provider.Property<String>abstract org.gradle.api.provider.ListProperty<Layer>The layers to copy to the image.protected abstract org.gradle.api.file.ProjectLayoutabstract org.gradle.api.provider.Property<org.graalvm.buildtools.gradle.dsl.NativeImageOptions>protected abstract org.gradle.api.model.ObjectFactoryprotected abstract org.gradle.api.provider.ProviderFactoryabstract org.gradle.api.provider.Property<Boolean>abstract org.gradle.api.provider.Property<String>The working directory to use in the container.abstract org.gradle.api.provider.Property<Boolean>If true, the COPY command will use --link option when copying files from the build context.Methods inherited from class com.bmuschko.gradle.docker.tasks.image.Dockerfile
addFile, addFile, addFile, arg, arg, copyFile, copyFile, copyFile, defaultCommand, defaultCommand, entryPoint, entryPoint, environmentVariable, environmentVariable, environmentVariable, exposePort, exposePort, from, from, from, getDestDir, getDestFile, getInstructions, healthcheck, healthcheck, instruction, instruction, instructionsFromTemplate, instructionsFromTemplate, instructionsFromTemplate, label, label, onBuild, onBuild, runCommand, runCommand, user, user, volume, volume, workingDir, workingDirMethods 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, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, 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 io.micronaut.gradle.docker.DockerBuildOptions
editDockerfile, getDockerfileTweaksMethods inherited from interface org.gradle.api.Task
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
-
Field Details
-
AMAZON_LINUX_BASE_IMAGE
- See Also:
-
-
Constructor Details
-
NativeImageDockerfile
public NativeImageDockerfile()
-
-
Method Details
-
getJdkVersion
- Returns:
- The JDK version to use with native image. Defaults to the toolchain version, or the current Java version.
-
getGraalArch
- Returns:
- The Graal architecture
-
getGraalImage
- Returns:
- the GraalVM docker image to use
-
getBaseImage
- Specified by:
getBaseImagein interfaceDockerBuildOptions- Returns:
- The base image to use
-
getArgs
- Specified by:
getArgsin interfaceDockerBuildOptions- Returns:
- The arguments to pass to the native image executable when starting up in the docker container.
-
getExposedPorts
- Specified by:
getExposedPortsin interfaceDockerBuildOptions- Returns:
- The exposed ports
-
getRequireGraalSdk
- Returns:
- Whether a Graal SDK is required (defaults to 'true').
-
getBuildStrategy
- Returns:
- The build strategy
-
getNativeImageOptions
public abstract org.gradle.api.provider.Property<org.graalvm.buildtools.gradle.dsl.NativeImageOptions> getNativeImageOptions() -
getJavaToolchainService
@Inject public abstract org.gradle.jvm.toolchain.JavaToolchainService getJavaToolchainService() -
getDefaultCommand
- Specified by:
getDefaultCommandin interfaceDockerBuildOptions- Returns:
- The default command to use
-
getGraalReleasesUrl
- Returns:
- URL of the Graal releases location
-
getGraalVMDistributionUrl
@Input @Optional public abstract org.gradle.api.provider.Property<String> getGraalVMDistributionUrl()Return the full URL of the GraalVM distribution to use. By default, it uses the base URL fromgetGraalReleasesUrl()and searches in a location known to exist when the plugin was built.- Returns:
- the URL of the GraalVM distribution to use
-
getTargetWorkingDirectory
Description copied from interface:DockerBuildOptionsThe working directory to use in the container. Defaults to /home/app- Specified by:
getTargetWorkingDirectoryin interfaceDockerBuildOptions- Returns:
- the target directory
-
getProviders
@Inject protected abstract org.gradle.api.provider.ProviderFactory getProviders() -
getObjects
@Inject protected abstract org.gradle.api.model.ObjectFactory getObjects() -
getLayout
@Inject protected abstract org.gradle.api.file.ProjectLayout getLayout() -
getTweaks
-
getLayers
The layers to copy to the image.- Returns:
- the layers
-
getUseCopyLink
If true, the COPY command will use --link option when copying files from the build context. Defaults to false.- Returns:
- The use copy link property
-
create
- Overrides:
createin classcom.bmuschko.gradle.docker.tasks.image.Dockerfile- Throws:
IOException
-
buildActualCommandLine
protected List<String> buildActualCommandLine(org.gradle.api.provider.Provider<String> executable, DockerBuildStrategy buildStrategy, NativeImageDockerfile.BaseImageForBuildStrategyResolver imageResolver) -
args
Adds additional args to pass to the native image executable.- Specified by:
argsin interfaceDockerBuildOptions- Parameters:
args- The args- Returns:
- This instance.
-
baseImage
Description copied from interface:DockerBuildOptionsThe base image to use.- Specified by:
baseImagein interfaceDockerBuildOptions- Parameters:
imageName- The base image name- Returns:
- This
-
exportPorts
- Specified by:
exportPortsin interfaceDockerBuildOptions- Parameters:
ports- The ports to expose- Returns:
- The ports
-