Class MicronautDockerfile

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.bmuschko.gradle.docker.tasks.image.Dockerfile
io.micronaut.gradle.docker.MicronautDockerfile
All Implemented Interfaces:
DockerBuildOptions, Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>
Direct Known Subclasses:
CRaCFinalDockerfile

public abstract class MicronautDockerfile extends com.bmuschko.gradle.docker.tasks.image.Dockerfile implements DockerBuildOptions
  • Nested Class Summary

    Nested 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.WorkDirInstruction

    Nested classes/interfaces inherited from interface org.gradle.api.Task

    org.gradle.api.Task.Namer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.gradle.api.provider.Property<DockerBuildStrategy>
     
    static final String
     
    static final String
     
    protected final org.gradle.api.provider.ListProperty<Integer>
     

    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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    applyStandardTransforms(org.gradle.api.provider.Provider<Boolean> useCopyLink, org.gradle.api.model.ObjectFactory objects, com.bmuschko.gradle.docker.tasks.image.Dockerfile task)
     
    args(String... args)
    Arguments for the entrypoint.
    baseImage(String imageName)
    The base image to use.
    void
     
    exportPorts(Integer... ports)
     
    org.gradle.api.provider.ListProperty<String>
     
    org.gradle.api.provider.Property<String>
     
    org.gradle.api.provider.Property<DockerBuildStrategy>
     
    org.gradle.api.provider.Property<String>
     
    org.gradle.api.provider.ListProperty<Integer>
     
    abstract org.gradle.api.provider.Property<org.gradle.api.JavaVersion>
     
    abstract org.gradle.api.provider.ListProperty<Layer>
    The layers to copy to the image.
    protected abstract org.gradle.api.model.ObjectFactory
     
    org.gradle.api.provider.Property<String>
    The working directory to use in the container.
    protected org.gradle.api.provider.Provider<List<String>>
     
    abstract org.gradle.api.provider.Property<Boolean>
    If true, the COPY command will use --link option when copying files from the build context.
    void
    The Dockerfile task requires a 'from' at least, but this will be replaced in setupTaskPostEvaluate where we also incorporate commands supplied by the build.gradle file (if required)
    protected void
    setupInstructions(List<com.bmuschko.gradle.docker.tasks.image.Dockerfile.Instruction> additionalInstructions)
     
    static void
    setupResources(com.bmuschko.gradle.docker.tasks.image.Dockerfile task, List<Layer> layers, String workDir)
     
    void
    This is executed post project evaluation

    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, workingDir

    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, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods 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, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.gradle.docker.DockerBuildOptions

    editDockerfile, getDockerfileTweaks

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, getConvention, notCompatibleWithConfigurationCache
  • Field Details

    • DEFAULT_WORKING_DIR

      public static final String DEFAULT_WORKING_DIR
      See Also:
    • DEFAULT_BASE_IMAGE

      public static final String DEFAULT_BASE_IMAGE
      See Also:
    • exposedPorts

      @Input protected final org.gradle.api.provider.ListProperty<Integer> exposedPorts
    • buildStrategy

      @Input protected final org.gradle.api.provider.Property<DockerBuildStrategy> buildStrategy
  • Constructor Details

    • MicronautDockerfile

      public MicronautDockerfile()
  • Method Details

    • getJdkVersion

      @Input public abstract org.gradle.api.provider.Property<org.gradle.api.JavaVersion> getJdkVersion()
      Returns:
      The JDK version to use with native image. Defaults to the toolchain version, or the current Java version.
    • getLayers

      @Input public abstract org.gradle.api.provider.ListProperty<Layer> getLayers()
      The layers to copy to the image.
      Returns:
      the layers
    • getUseCopyLink

      @Input @Optional public abstract org.gradle.api.provider.Property<Boolean> 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
    • getTargetWorkingDirectory

      public org.gradle.api.provider.Property<String> getTargetWorkingDirectory()
      Description copied from interface: DockerBuildOptions
      The working directory to use in the container. Defaults to /home/app
      Specified by:
      getTargetWorkingDirectory in interface DockerBuildOptions
      Returns:
      the target directory
    • getDefaultCommand

      public org.gradle.api.provider.Property<String> getDefaultCommand()
      Specified by:
      getDefaultCommand in interface DockerBuildOptions
      Returns:
      The default command to use
    • getObjects

      @Inject protected abstract org.gradle.api.model.ObjectFactory getObjects()
    • getTweaks

      @Input @Optional protected org.gradle.api.provider.Provider<List<String>> getTweaks()
    • create

      public void create() throws IOException
      Overrides:
      create in class com.bmuschko.gradle.docker.tasks.image.Dockerfile
      Throws:
      IOException
    • applyStandardTransforms

      public static void applyStandardTransforms(org.gradle.api.provider.Provider<Boolean> useCopyLink, org.gradle.api.model.ObjectFactory objects, com.bmuschko.gradle.docker.tasks.image.Dockerfile task)
    • setupInstructions

      protected void setupInstructions(List<com.bmuschko.gradle.docker.tasks.image.Dockerfile.Instruction> additionalInstructions)
    • setupDockerfileInstructions

      public void setupDockerfileInstructions()
      The Dockerfile task requires a 'from' at least, but this will be replaced in setupTaskPostEvaluate where we also incorporate commands supplied by the build.gradle file (if required)
    • setupTaskPostEvaluate

      public void setupTaskPostEvaluate()
      This is executed post project evaluation
    • getBuildStrategy

      public org.gradle.api.provider.Property<DockerBuildStrategy> getBuildStrategy()
      Returns:
      The build strategy.
    • getArgs

      public org.gradle.api.provider.ListProperty<String> getArgs()
      Specified by:
      getArgs in interface DockerBuildOptions
      Returns:
      The arguments to use
    • getBaseImage

      public org.gradle.api.provider.Property<String> getBaseImage()
      Specified by:
      getBaseImage in interface DockerBuildOptions
      Returns:
      The base image to use
    • getExposedPorts

      public org.gradle.api.provider.ListProperty<Integer> getExposedPorts()
      Specified by:
      getExposedPorts in interface DockerBuildOptions
      Returns:
      The exposed ports
    • args

      public DockerBuildOptions args(String... args)
      Description copied from interface: DockerBuildOptions
      Arguments for the entrypoint.
      Specified by:
      args in interface DockerBuildOptions
      Parameters:
      args - The arguments
      Returns:
      This
    • baseImage

      public DockerBuildOptions baseImage(String imageName)
      Description copied from interface: DockerBuildOptions
      The base image to use.
      Specified by:
      baseImage in interface DockerBuildOptions
      Parameters:
      imageName - The base image name
      Returns:
      This
    • exportPorts

      public DockerBuildOptions exportPorts(Integer... ports)
      Specified by:
      exportPorts in interface DockerBuildOptions
      Parameters:
      ports - The ports to expose
      Returns:
      The ports
    • setupResources

      public static void setupResources(com.bmuschko.gradle.docker.tasks.image.Dockerfile task, List<Layer> layers, String workDir)