Multiplatform image with spring-boot separate layers from fatjar #3721
Answered
by
davidecavestro
davidecavestro
asked this question in
Q&A
-
Hi, I'm trying to generate a multiplatform image to package and distribute in separate layers the contents of a spring boot fatjar. Any idea? This is an example pom.xml for kubernetes-maven-plugin. <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>3.4.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.4.5</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>1.18.1</version>
<configuration>
<buildStrategy>jib</buildStrategy>
<generator>
<includes>
<include>spring-boot</include>
</includes>
<config>
<spring-boot>
<!-- <from>eclipse-temurin:17</from> -->
<name>localhost:5000/${project.artifactId}:${project.version}</name>
<targetDir>/app</targetDir>
<add>true</add>
</spring-boot>
</config>
</generator>
<images>
<image>
<name>localhost:5000/${project.artifactId}:${project.version}</name>
<build>
<from>eclipse-temurin:17</from>
<platforms>linux/amd64,linux/arm64</platforms>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</project>
|
Beta Was this translation helpful? Give feedback.
Answered by
davidecavestro
May 27, 2025
Replies: 1 comment
-
So I stumbled upon #3642, suggesting the usage of |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
davidecavestro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I stumbled upon #3642, suggesting the usage of
-Djkube.container-image.platforms.1=linux/amd64 -Djkube.container-image.platforms.2=linux/arm64
which actually works...