Add docker-images: one Spring Boot 4 service packaged nine ways

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
This commit is contained in:
2026-09-11 17:11:46 +00:00
co-authored by Claude Opus 5
parent 86246dc860
commit 644da9e65e
52 changed files with 1308 additions and 1 deletions
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# The jlink image built from jdeps' module list alone runs fine - and exports fewer metrics.
# Diffs /actuator/prometheus metric names against the full-JRE image. -> docs/output/jlink-metrics.txt
set -uo pipefail
source "$(dirname "$0")/env.sh"
names() {
local name="jl-$$-$2"
docker rm -f "$name" > /dev/null 2>&1
docker run -d --name "$name" -p "$2:8080" "$1" > /dev/null
for _ in $(seq 1 300); do curl -s -o /dev/null "localhost:$2/actuator/health" && break; sleep 0.1; done
curl -s -o /dev/null "localhost:$2/api/items"
curl -s "localhost:$2/actuator/prometheus" | grep -v '^#' | sed 's/[{ ].*//' | sort -u
docker logs "$name" 2>&1 | grep -E ' WARN ' | sed 's/^.* WARN [0-9]* --- \[[^]]*\] \[ *[^]]*\] //' >&2
docker rm -f "$name" > /dev/null
}
{
echo "# jlink modules chosen by jdeps alone:"
docker run --rm --entrypoint /opt/jre/bin/java sbd/docker-images:jlink-jdeps-only --list-modules | sed 's/@.*//' | tr '\n' ' '; echo
echo
echo "# WARN lines at startup of the jdeps-only image:"
names sbd/docker-images:jlink-jdeps-only 18101 2>&1 >/tmp/jl-a.txt | sed 's/^/ /'
names sbd/docker-images:layered-distroless 18102 2>/dev/null > /tmp/jl-b.txt
names sbd/docker-images:jlink-distroless 18103 2>/dev/null > /tmp/jl-c.txt
echo
echo "# Metric names: full JRE $(wc -l < /tmp/jl-b.txt), jdeps-only $(wc -l < /tmp/jl-a.txt), jdeps + jdk.management $(wc -l < /tmp/jl-c.txt)"
echo "# Present with the full JRE, missing from the jdeps-only image:"
comm -23 /tmp/jl-b.txt /tmp/jl-a.txt | sed 's/^/ /'
echo "# Missing from jdeps + jdk.management: $(comm -23 /tmp/jl-b.txt /tmp/jl-c.txt | wc -l)"
comm -23 /tmp/jl-b.txt /tmp/jl-c.txt | sed 's/^/ /'
echo "# (jvm_gc_concurrent_phase_time_* is registered lazily, after the first G1 concurrent cycle -"
echo "# whether it appears within a few seconds of startup varies run to run, in either image.)"
} | tee "$OUT/jlink-metrics.txt"