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
FieldsModifier and TypeFieldDescriptionList of additional arguments that will be passed to the application.protected final ApplicationConfigurationServicestatic final Stringprotected StringThe Docker image used to run the native image.static final Stringstatic final Stringprotected final DockerServiceprotected final org.apache.maven.plugin.PluginParameterExpressionEvaluatorstatic final Stringprotected final JibConfigurationServicestatic final Stringprotected StringThe main class of the application, as defined in the Exec Maven Plugin.protected final org.apache.maven.project.MavenProjectprotected final org.apache.maven.execution.MavenSessionprotected StringThe target runtime of the application.static final StringAdditional arguments that will be passed to thenative-imageexecutable.protected StringNetworking mode for the RUN instructions during build.static final Stringprotected StringThe version of Oracle Linux to use as a native-compile base when building a native image inside a Docker container.protected BooleanWhether to produce a static native image when usingdocker-nativepackaging.static final StringFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDockerMojo(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 voidCopy project dependencies to atarget/dependencydirectory.protected Stringprotected StringgetCmd()protected StringgetFrom()protected StringgetPorts()getTags()protected Stringprotected Stringprotected Stringprotected booleanisArm()Check os.arch against known ARM architecture identifiers.protected org.apache.maven.artifact.versioning.ArtifactVersionprotected voidoracleCloudFunctionCmd(File dockerfile) Adds cmd to docker oracle cloud function file.Methods inherited from class io.micronaut.maven.AbstractMicronautMojo
setLogMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
-
GDS_DOWNLOAD_URL
- See Also:
-
mavenProject
-
mavenSession
-
jibConfigurationService
-
applicationConfigurationService
-
dockerService
-
expressionEvaluator
-
nativeImageBuildArgs
Additional arguments that will be passed to thenative-imageexecutable. Note that this will only be used when using a packaging of typedocker-native. Fornative-imagepackaging 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-nativepackaging. -
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.targetproperty or thejava.versionproperty.
-
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.archsystem 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/dependencydirectory.- Throws:
IOException
-
getCmd
- Returns:
- the Docker CMD command.
-
getNetworkMode
- Returns:
- Networking mode for the RUN instructions during build (if any).
-
getProxyBuildArgs
- Returns:
- Map of proxy-related build arguments for Docker builds.
-
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
-