Companion code for "Dockerizing Spring Boot 4: Layered Jars, Buildpacks, Distroless and Image Size Benchmarks". Fat jar on JDK and JRE, layered jar on Debian, Alpine and distroless, jlink, the JDK 25 AOT cache, Paketo buildpacks and Jib, each measured for size on disk and pushed, rebuild delta, startup, user and shell. Also PID 1 and signal handling, the jdeps module gap, AOT cache mismatches and buildpacks memory calculation. Transcripts in docs/output/, regenerated by scripts/run-all.sh. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
135 lines
4.8 KiB
XML
135 lines
4.8 KiB
XML
<?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>
|
|
|
|
<parent>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-parent</artifactId>
|
|
<version>4.1.1</version>
|
|
<relativePath/>
|
|
</parent>
|
|
|
|
<groupId>com.ankurm</groupId>
|
|
<artifactId>docker-images</artifactId>
|
|
<version>1.0.0</version>
|
|
<name>docker-images</name>
|
|
<description>Dockerizing Spring Boot 4: layered jars, buildpacks, distroless, jlink, AOT cache - measured</description>
|
|
|
|
<properties>
|
|
<java.version>25</java.version>
|
|
<jib.version>3.5.2</jib.version>
|
|
<!-- A property rather than a literal, so scripts can tag a second build: an explicit
|
|
<name> in the plugin configuration wins over -Dspring-boot.build-image.imageName. -->
|
|
<buildpacks.image>sbd/docker-images:buildpacks</buildpacks.image>
|
|
</properties>
|
|
|
|
<dependencies>
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-webmvc</artifactId>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-validation</artifactId>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>io.micrometer</groupId>
|
|
<artifactId>micrometer-registry-prometheus</artifactId>
|
|
<scope>runtime</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-starter-test</artifactId>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
</dependencies>
|
|
|
|
<build>
|
|
<finalName>app</finalName>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
<configuration>
|
|
<image>
|
|
<name>${buildpacks.image}</name>
|
|
</image>
|
|
</configuration>
|
|
</plugin>
|
|
<!-- Jib builds without a Dockerfile and without a daemon. Run with
|
|
mvn jib:dockerBuild (to a local daemon) or jib:buildTar. -->
|
|
<plugin>
|
|
<groupId>com.google.cloud.tools</groupId>
|
|
<artifactId>jib-maven-plugin</artifactId>
|
|
<version>${jib.version}</version>
|
|
<configuration>
|
|
<from>
|
|
<image>eclipse-temurin:25-jre</image>
|
|
</from>
|
|
<to>
|
|
<image>sbd/docker-images:jib</image>
|
|
</to>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
|
|
<profiles>
|
|
<!-- Only needed when the buildpack build container must reach the internet through a
|
|
TLS-intercepting proxy - a corporate network, or the sandbox this repo was built in.
|
|
The Java buildpack downloads a JRE at build time; without these, that download fails
|
|
with a certificate error. See docs/04-buildpacks.md. -->
|
|
<profile>
|
|
<id>corporate-proxy</id>
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
<configuration>
|
|
<image>
|
|
<network>host</network>
|
|
<env>
|
|
<HTTPS_PROXY>${env.HTTPS_PROXY}</HTTPS_PROXY>
|
|
<https_proxy>${env.HTTPS_PROXY}</https_proxy>
|
|
</env>
|
|
<bindings combine.children="append">
|
|
<binding>${project.basedir}/bindings/ca-certificates:/platform/bindings/ca-certificates</binding>
|
|
</bindings>
|
|
</image>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
<!-- Only needed when the build container cannot reach Maven Central at all. The Spring Boot
|
|
buildpack downloads Spring Cloud Bindings from repo1.maven.org during the build; a
|
|
dependency-mapping binding points it at a local copy instead. scripts/fetch-buildpack-deps.sh
|
|
downloads the jar. Combine with corporate-proxy: -Pcorporate-proxy,no-maven-central -->
|
|
<profile>
|
|
<id>no-maven-central</id>
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.springframework.boot</groupId>
|
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
<configuration>
|
|
<image>
|
|
<bindings combine.children="append">
|
|
<binding>${project.basedir}/bindings/dependency-mapping:/platform/bindings/dependency-mapping</binding>
|
|
</bindings>
|
|
</image>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
</profiles>
|
|
</project>
|