Add jib: Spring Boot 4.2.0 images with Jib 3.5.2 vs Buildpacks

Same app built both ways: layers, reproducible digest, extraDirectories, registry push
without a daemon, wrong-JRE and missing-compile failures, Buildpacks memory calculator at
512 MB. Captured output in jib/output, regenerated by jib/scripts/run-all.sh.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
This commit is contained in:
Ankur Mhatre
2026-12-01 08:32:09 +05:30
co-authored by Claude Sonnet 5.5
parent ddc3ec9d90
commit bb12eaca0a
30 changed files with 744 additions and 0 deletions
+111
View File
@@ -0,0 +1,111 @@
<?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.2.0</version>
<relativePath/>
</parent>
<groupId>com.ankurm.jibdemo</groupId>
<artifactId>jib-demo</artifactId>
<version>1.0.0</version>
<name>jib-demo: Spring Boot image without a Dockerfile</name>
<properties>
<java.version>25</java.version>
<jib.version>3.5.2</jib.version>
<!-- Where the image is pushed/tagged. Overridable: -Dimage.name=localhost:5000/jib-demo -->
<image.name>jib-demo</image.name>
</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>
</dependencies>
<build>
<plugins>
<!-- Needed only for the Buildpacks comparison (spring-boot:build-image). Jib ignores its repackaged jar. -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>${image.name}:buildpacks</name>
</image>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib.version}</version>
<configuration>
<to>
<image>${image.name}</image>
<tags>
<tag>${project.version}</tag>
</tags>
</to>
<container>
<ports>
<port>8080</port>
</ports>
<jvmFlags>
<jvmFlag>-XX:MaxRAMPercentage=75</jvmFlag>
</jvmFlags>
<user>1000</user>
<labels>
<org.opencontainers.image.title>jib-demo</org.opencontainers.image.title>
<org.opencontainers.image.source>https://ankurm.com/git.app/asmhatre/java-devops-demo</org.opencontainers.image.source>
</labels>
<!-- creationTime defaults to EPOCH, which is what makes two builds byte-identical. -->
</container>
<!-- Files under src/main/jib are copied into the image root (src/main/jib/etc/motd.txt -> /etc/motd.txt). -->
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!--
Buildpacks behind a TLS-intercepting corporate proxy. The builder container downloads the JRE
at build time, so it needs the proxy address and the proxy's CA certificate.
Usage: mvn -Pcorp-proxy -Dproxy.url=http://127.0.0.1:41629 -Dca.dir=/path/with/type+ca.crt spring-boot:build-image
Jib does not need this: its base image is pulled from a registry by the host JVM.
-->
<profile>
<id>corp-proxy</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<network>host</network>
<env>
<HTTPS_PROXY>${proxy.url}</HTTPS_PROXY>
<https_proxy>${proxy.url}</https_proxy>
</env>
<bindings>
<binding>${ca.dir}:/platform/bindings/ca-certs:ro</binding>
</bindings>
</image>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>