Skip to content

Latest commit

 

History

History
98 lines (82 loc) · 2.71 KB

fabric8dockerplugin.adoc

File metadata and controls

98 lines (82 loc) · 2.71 KB

Fabric8 docker plugin

Plugin configuration

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.41.0</version>
        <configuration>
          <images>
            <image>
              <name>localhost:5000/firstimage/${project.artifactId}:latest</name>
              <build>
                <from>eclipse-temurin:11</from>
                <assembly>
                  <name>deployments</name>
                  <inline>
                    <id>copy-dependencies</id>
                    <formats>
                      <format>dir</format>
                    </formats>
                    <fileSets>
                      <fileSet>
                          <outputDirectory>dependencies</outputDirectory>
                        <directory>${project.basedir}/../context/dependencies</directory>
                      </fileSet>
                    </fileSets>
                  </inline>
                </assembly>
                <cmd>
                  <shell>jshell</shell>
                </cmd>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>

By default the plugin use the default assembly descriptors to copy the artifacts and dependencies .

The assembly configuration is used to override the default build from the plugin to send all the context content as it is in /deployments/dependencies.

The maven command used is docker:build docker:push -Ddocker.build.jib=true. An example would be :

mvn -e docker:build docker:push -Ddocker.build.jib=true -Dmaven.repo.local=/tmp/artifacts/m2 --global-settings /tmp/kit-cfkvvqjdm89s73c9irb0-351212210/maven/settings.xml -Dmaven.artifact.threads=12 -T 12

Incremental build

✔️
Incremental build is validated
First image
Figure 1. First image
Second image
Figure 2. Second image
Third image
Figure 3. Third image

Multi-architecture

✔️
Multi-architecture is validated

The Fabric8 docker maven plugins allow to configures platforms of base images to select from a manifest list.

          <build>
            ...
            <buildx>
              <platforms>
                <platform>linux/amd64</platform>
                <platform>linux/arm64</platform>
              </platforms>
            </buildx>
          </build>