Image Configuration
The plugin’s configuration is centered around images.Images can be either configured individually, as part of a batch or a combination of both.
When configured individually, each image is specified in the <images>
element of the configuration with one <image>
element per image to use.
The <image>
element can contain the following sub elements:
Element | Description |
---|---|
name |
Each NOTE: Currently image names cannot include registry and tag parts. |
customImageNameForMultiStageContainerfile |
A When set to false, but the |
Defines a list of custom image names per stage listed in a |
|
Element that contains all the configuration aspects when doing a podman:build. |
A <build>
section must be present for each image configuration.
<configuration>
...
<images>
<image>
<name>your-image-name</name>
<customImageNameForMultiStageContainerfile>true</customImageNameForMultiStageContainerfile>
<stages>...</stages>
<build>...</build>
</image>
</images>
...
</configuration>
Batch Configuration
In some special cases it may be convenient to configure a series of images at once, e.g. if there are multiple Containerfiles
in your project which all share the same configuration but only differ by name.
A batch configuraion can be configured within the <batch/>
element of the configuration. It is possible to specify one batch configuration.
The <batch/>
element supports the same elements as the <image/>
element. An example configuration is provided below.
Resulting image names must be unique, otherwise one image may overwrite another. |
<configuration>
...
<batch>
<name>your-image-name</name>
<customImageNameForMultiStageContainerfile>true</customImageNameForMultiStageContainerfile>
<stages>...</stages>
<build>...</build>
</batch>
</configuration>
Stage Configuration
The stages
configuration section is useful when working with multi-stage Containerfiles
.
Element | Description |
---|---|
name |
The name of the stage in a |
imageName |
The target name that the image, which was built in stage with |
<configuration>
...
<images>
<image>
<stages>
<stage>
<name>some_stage</name>
<imageName>my-fancy-image</imageName>
</stage>
</stages>
</image>
</images>
...
</configuration>
Image Names
When providing an image name in either the <image/>
or <batch/
> configuration with the <name>
field, there are several placeholders available for use.These placeholders are replaced by this plugin at runtime, before each goal executes.In addition you can use regular Maven properties which are resolved by Maven itself.
These placeholders also work when using a custom image name per stage. |
Placeholder | Description |
---|---|
a |
Sanitized version of the artifactId that can be used as part of a container image name.The artifactId is converted to lowercase as per container naming conventions. |
d |
A sanitized version of the directory name where the |
g |
The last part of the Maven groupId. Everything after the last |
n |
Returns a sequence number, which could be useful in e.g. a batch image configuration. An image named |
l |
If the project version ends with |
t |
Resolves to |
v |
The project version. See also: |