Fork me on GitHub

mn:dockerfile

Full name:

io.micronaut.maven:micronaut-maven-plugin:5.1.0-SNAPSHOT:dockerfile

Description:

Generates a Dockerfile depending on the packaging and micronaut.runtime properties.

mvn mn:dockerfile -Dpackaging=docker-native -Dmicronaut.runtime=lambda

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: compile+runtime.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Since version: 1.1.
  • Invokes the execution of the following lifecycle phase prior to executing itself: process-classes.

Required Parameters

Name Type Since Description
<mainClass> String - The main class of the application, as defined in the Exec Maven Plugin.
Default: ${exec.mainClass}

Optional Parameters

Name Type Since Description
<appArguments> List<String> - List of additional arguments that will be passed to the application.
User Property: mn.appArgs
<baseImage> String 5.0.0 The builder-stage base image used to build the native image for docker-native packaging variants.
User Property: micronaut.native-image.base-image
<baseImageRun> String 1.2 The Docker image used to run the native image.
Default: cgr.dev/chainguard/wolfi-base@sha256:52e71f61c6afd1f8d2625cff4465d8ecee156668ca665f7e9c582d1cc914eb6a
User Property: micronaut.native-image.base-image-run
<jdkAotCache> boolean 5.1.0 Whether the generated Dockerfile trains a JDK AOT cache (Java 25 or later) while the image is built, and starts the application with it so that it starts faster. Only for docker packaging, and not for the lambda or oracle_function runtimes. The base image needs bash.
Default: false
User Property: micronaut.docker.jdkAotCache
<jdkAotCacheTrainingMode> TrainingMode 5.1.0 How the JDK AOT cache is trained. LOAD loads the application's bean definitions and exits without starting it, so the training needs no database or other service. START starts the application, sends the training requests and stops it, which trains a more complete cache. When not set, the mode is LOAD if the application's Micronaut version supports it (Micronaut Core 5.3.0 or later), and START otherwise.
User Property: micronaut.docker.jdkAotCache.trainingMode
<jdkAotCacheTrainingPaths> List<String> 5.1.0 The paths that a START training run sends a GET request to once the application is ready. A short, representative warm-up makes a better cache. A request that gets no response, or a status of 500 or more, fails the build. A status from 400 to 499 is logged as a warning with Micronaut Core 5.3.0 or later, and fails the build with earlier versions.
User Property: micronaut.docker.jdkAotCache.trainingPaths
<jdkAotCacheTrainingTimeout> int 5.1.0 The timeout, in seconds, of the JDK AOT cache training run. With Micronaut Core before 5.3.0, it applies to each step: waiting for the application to be ready, each training request, and waiting for the application to exit.
Default: 180
User Property: micronaut.docker.jdkAotCache.trainingTimeout
<jibBuildGoal> String 5.0.0

Jib goal used to build Docker images for docker packaging.

Defaults to dockerBuild. Set it to buildTar or build to avoid talking to a local Docker daemon during package.


Default: dockerBuild
User Property: jib.buildGoal
<lambdaBootstrapArguments> List<String> 5.0.0 Additional arguments that will be appended to the generated AWS Lambda native bootstrap command.
User Property: micronaut.lambda.bootstrap.args
<micronautRuntime> String - The target runtime of the application.
Default: NONE
User Property: micronaut.runtime
<nativeImageBuildArgs> List<String> - Additional arguments that will be passed to the native-image executable. Note that this will only be used when using a packaging of type docker-native. For native-image packaging you should use the Native Image Maven Plugin configuration options.
User Property: micronaut.native-image.args
<networkMode> String 4.0.0 Networking mode for the RUN instructions during build.
User Property: docker.networkMode
<oracleLinuxVersion> String - The version of Oracle Linux to use as a native-compile base when building a native image inside a Docker container.
Default: ol9
User Property: micronaut.native-image.ol.version
<staticNativeImage> Boolean - Whether to produce a static native image when using docker-native packaging.
Default: false
User Property: micronaut.native-image.static

Parameter Details

<appArguments>

List of additional arguments that will be passed to the application.
  • Type: java.util.List<java.lang.String>
  • Required: No
  • User Property: mn.appArgs

<baseImage>

The builder-stage base image used to build the native image for docker-native packaging variants.
  • Type: java.lang.String
  • Since: 5.0.0
  • Required: No
  • User Property: micronaut.native-image.base-image

<baseImageRun>

The Docker image used to run the native image.
  • Type: java.lang.String
  • Since: 1.2
  • Required: No
  • User Property: micronaut.native-image.base-image-run
  • Default: cgr.dev/chainguard/wolfi-base@sha256:52e71f61c6afd1f8d2625cff4465d8ecee156668ca665f7e9c582d1cc914eb6a

<jdkAotCache>

Whether the generated Dockerfile trains a JDK AOT cache (Java 25 or later) while the image is built, and starts the application with it so that it starts faster. Only for docker packaging, and not for the lambda or oracle_function runtimes. The base image needs bash.
  • Type: boolean
  • Since: 5.1.0
  • Required: No
  • User Property: micronaut.docker.jdkAotCache
  • Default: false

<jdkAotCacheTrainingMode>

How the JDK AOT cache is trained. LOAD loads the application's bean definitions and exits without starting it, so the training needs no database or other service. START starts the application, sends the training requests and stops it, which trains a more complete cache. When not set, the mode is LOAD if the application's Micronaut version supports it (Micronaut Core 5.3.0 or later), and START otherwise.
  • Type: io.micronaut.maven.jdkaotcache.TrainingMode
  • Since: 5.1.0
  • Required: No
  • User Property: micronaut.docker.jdkAotCache.trainingMode

<jdkAotCacheTrainingPaths>

The paths that a START training run sends a GET request to once the application is ready. A short, representative warm-up makes a better cache. A request that gets no response, or a status of 500 or more, fails the build. A status from 400 to 499 is logged as a warning with Micronaut Core 5.3.0 or later, and fails the build with earlier versions.
  • Type: java.util.List<java.lang.String>
  • Since: 5.1.0
  • Required: No
  • User Property: micronaut.docker.jdkAotCache.trainingPaths

<jdkAotCacheTrainingTimeout>

The timeout, in seconds, of the JDK AOT cache training run. With Micronaut Core before 5.3.0, it applies to each step: waiting for the application to be ready, each training request, and waiting for the application to exit.
  • Type: int
  • Since: 5.1.0
  • Required: No
  • User Property: micronaut.docker.jdkAotCache.trainingTimeout
  • Default: 180

<jibBuildGoal>

Jib goal used to build Docker images for docker packaging.

Defaults to dockerBuild. Set it to buildTar or build to avoid talking to a local Docker daemon during package.

  • Type: java.lang.String
  • Since: 5.0.0
  • Required: No
  • User Property: jib.buildGoal
  • Default: dockerBuild

<lambdaBootstrapArguments>

Additional arguments that will be appended to the generated AWS Lambda native bootstrap command.
  • Type: java.util.List<java.lang.String>
  • Since: 5.0.0
  • Required: No
  • User Property: micronaut.lambda.bootstrap.args

<mainClass>

The main class of the application, as defined in the Exec Maven Plugin.
  • Type: java.lang.String
  • Required: Yes
  • Default: ${exec.mainClass}

<micronautRuntime>

The target runtime of the application.
  • Type: java.lang.String
  • Required: No
  • User Property: micronaut.runtime
  • Default: NONE

<nativeImageBuildArgs>

Additional arguments that will be passed to the native-image executable. Note that this will only be used when using a packaging of type docker-native. For native-image packaging you should use the Native Image Maven Plugin configuration options.
  • Type: java.util.List<java.lang.String>
  • Required: No
  • User Property: micronaut.native-image.args

<networkMode>

Networking mode for the RUN instructions during build.
  • Type: java.lang.String
  • Since: 4.0.0
  • Required: No
  • User Property: docker.networkMode

<oracleLinuxVersion>

The version of Oracle Linux to use as a native-compile base when building a native image inside a Docker container.
  • Type: java.lang.String
  • Required: No
  • User Property: micronaut.native-image.ol.version
  • Default: ol9

<staticNativeImage>

Whether to produce a static native image when using docker-native packaging.
  • Type: java.lang.Boolean
  • Required: No
  • User Property: micronaut.native-image.static
  • Default: false