Package io.micronaut.maven
Class AbstractDockerMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
io.micronaut.maven.AbstractMicronautMojo
io.micronaut.maven.AbstractDockerMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
DockerCracMojo
,DockerfileMojo
,DockerMojo
,DockerNativeMojo
,DockerPushMojo
Abstract base class for mojos related to Docker files and builds.
- Since:
- 1.1
- Author:
- Álvaro Sánchez-Mariscal, Iván López
-
Field Summary
Modifier and TypeFieldDescriptionList of additional arguments that will be passed to the application.protected final ApplicationConfigurationService
static final String
protected String
The Docker image used to run the native image.static final String
static final String
protected final DockerService
protected final org.apache.maven.plugin.PluginParameterExpressionEvaluator
static final String
static final String
protected final JibConfigurationService
static final String
protected String
The main class of the application, as defined in the Exec Maven Plugin.protected final org.apache.maven.project.MavenProject
protected String
The target runtime of the application.static final String
Additional arguments that will be passed to thenative-image
executable.protected String
Networking mode for the RUN instructions during build.static final String
protected String
The version of Oracle Linux to use as a native-compile base when building a native image inside a Docker container.protected Boolean
Whether to produce a static native image when usingdocker-native
packaging.static final String
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDockerMojo
(org.apache.maven.project.MavenProject mavenProject, JibConfigurationService jibConfigurationService, ApplicationConfigurationService applicationConfigurationService, DockerService dockerService, org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.plugin.MojoExecution mojoExecution) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Copy project dependencies to atarget/dependency
directory.protected String
protected String
getCmd()
protected String
getFrom()
protected String
getPorts()
getTags()
protected String
protected String
protected String
protected boolean
isArm()
Check os.arch against known ARM architecture identifiers.protected org.apache.maven.artifact.versioning.ArtifactVersion
protected void
oracleCloudFunctionCmd
(File dockerfile) Adds cmd to docker oracle cloud function file.Methods inherited from class io.micronaut.maven.AbstractMicronautMojo
setLog
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setPluginContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
LATEST_TAG
- See Also:
-
DEFAULT_BASE_IMAGE_GRAALVM_RUN
- See Also:
-
MOSTLY_STATIC_NATIVE_IMAGE_GRAALVM_FLAG
- See Also:
-
ARM_ARCH
- See Also:
-
X86_64_ARCH
- See Also:
-
DEFAULT_ORACLE_LINUX_VERSION
- See Also:
-
ORACLE_CLOUD_FUNCTION_DEFAULT_CMD
- See Also:
-
GRAALVM_DOWNLOAD_URL
- See Also:
-
GRAALVM_FOR_JDK17
- See Also:
-
mavenProject
-
jibConfigurationService
-
applicationConfigurationService
-
dockerService
-
expressionEvaluator
-
nativeImageBuildArgs
Additional arguments that will be passed to thenative-image
executable. Note that this will only be used when using a packaging of typedocker-native
. Fornative-image
packaging you should use the Native Image Maven Plugin configuration options. -
appArguments
List of additional arguments that will be passed to the application. -
mainClass
The main class of the application, as defined in the Exec Maven Plugin. -
staticNativeImage
@Parameter(defaultValue="false", property="micronaut.native-image.static") protected Boolean staticNativeImageWhether to produce a static native image when usingdocker-native
packaging. -
micronautRuntime
The target runtime of the application. -
baseImageRun
@Parameter(property="micronaut.native-image.base-image-run", defaultValue="cgr.dev/chainguard/wolfi-base:latest") protected String baseImageRunThe Docker image used to run the native image.- Since:
- 1.2
-
oracleLinuxVersion
@Parameter(property="micronaut.native-image.ol.version", defaultValue="ol9") protected String oracleLinuxVersionThe version of Oracle Linux to use as a native-compile base when building a native image inside a Docker container. -
networkMode
Networking mode for the RUN instructions during build.- Since:
- 4.0.0
-
-
Constructor Details
-
AbstractDockerMojo
protected AbstractDockerMojo(org.apache.maven.project.MavenProject mavenProject, JibConfigurationService jibConfigurationService, ApplicationConfigurationService applicationConfigurationService, DockerService dockerService, org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.plugin.MojoExecution mojoExecution)
-
-
Method Details
-
javaVersion
- Returns:
- the Java version from either the
maven.compiler.target
property or thejava.version
property.
-
graalVmJvmVersion
- Returns:
- the JVM version to use for GraalVM.
-
graalVmDownloadUrl
- Returns:
- the GraalVM download URL depending on the Java version.
-
graalVmArch
- Returns:
- the OS architecture to use for GraalVM depending on the
os.arch
system property.
-
getFrom
- Returns:
- the base FROM image for the native image.
-
isArm
Check os.arch against known ARM architecture identifiers.- Returns:
- true if we think we're running on an arm JDK
-
getFromImage
- Returns:
- the base image from the jib configuration (if any).
-
getTags
- Returns:
- the Docker image tags by looking at the Jib plugin configuration.
-
getPorts
- Returns:
- the application ports to expose by looking at the Jib configuration or the application configuration.
-
copyDependencies
Copy project dependencies to atarget/dependency
directory.- Throws:
IOException
-
getCmd
- Returns:
- the Docker CMD command.
-
getNetworkMode
- Returns:
- Networking mode for the RUN instructions during build (if any).
-
getBaseImage
- Returns:
- the base image to use for the Dockerfile.
-
oracleCloudFunctionCmd
Adds cmd to docker oracle cloud function file.- Parameters:
dockerfile
- the docker file- Throws:
IOException
-