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
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Who is PID 1, does SIGTERM reach the JVM, and how long does `docker stop` take?
# -> docs/output/pid1-and-signals.txt
set -uo pipefail
source "$(dirname "$0")/env.sh"
probe() {
local tag="$1" name="sig-$$"
docker rm -f "$name" > /dev/null 2>&1
docker run -d --name "$name" "sbd/docker-images:$tag" > /dev/null
for _ in $(seq 1 200); do docker logs "$name" 2>&1 | grep -q 'Started ImagesApplication' && break; sleep 0.1; done
local pid1
# NUL-separated argv; translate in the pipe (a shell variable cannot hold NUL bytes)
pid1=$(docker exec "$name" cat /proc/1/cmdline 2>/dev/null | tr '\0' ' ')
case "$pid1" in ""|*"exec failed"*) pid1="(image has no cat; ENTRYPOINT is exec form)" ;; esac
local t0 t1; t0=$(date +%s%N); docker stop "$name" > /dev/null; t1=$(date +%s%N)
local code; code=$(docker inspect -f '{{.State.ExitCode}}' "$name")
local graceful; graceful=$(docker logs "$name" 2>&1 | grep -c 'Commencing graceful shutdown' || true)
printf '%-22s PID 1: %-58s docker stop: %5d ms exit code: %-4s graceful-shutdown log lines: %s\n' \
"$tag" "${pid1:0:58}" "$(( (t1 - t0) / 1000000 ))" "$code" "$graceful"
docker rm -f "$name" > /dev/null
}
{
echo "# docker stop sends SIGTERM to PID 1, waits 10 s, then SIGKILL. Exit code 143 = the JVM handled"
echo "# SIGTERM (128+15). 137 = it was killed (128+9)."
echo
for t in layered-jre shell-form shell-form-alpine shell-form-wrapper layered-distroless; do probe "$t"; done
echo
echo "# What /bin/sh is in each base image:"
echo "eclipse-temurin:25-jre -> $(docker run --rm --entrypoint readlink eclipse-temurin:25-jre -f /bin/sh)"
echo "eclipse-temurin:25-jre-alpine -> $(docker run --rm --entrypoint readlink eclipse-temurin:25-jre-alpine -f /bin/sh)"
} | tee "$OUT/pid1-and-signals.txt"