Skip to content

build(docker): add multi-stage distroless image and ci verification - #143

Merged
tiana-code merged 2 commits into
mainfrom
feat/E-01-dockerfile
Jun 16, 2026
Merged

build(docker): add multi-stage distroless image and ci verification#143
tiana-code merged 2 commits into
mainfrom
feat/E-01-dockerfile

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

What

First slice of the E-01 ops cluster. Adds a container image for the ledger service.

  • Root Dockerfile, two named stages: builder (eclipse-temurin:21-jdk, builds the bootJar via the gradle wrapper, tests excluded - ITs need Postgres and run in build-test) and runtime (gcr.io/distroless/java21-debian12:nonroot, carries only the jar, rootless, EXPOSE 8080, ENTRYPOINT ["java","-jar","/app/app.jar"]).
  • The builder copies the bootJar via find ... ! -name '*-plain.jar' so the Spring Boot plain jar never collides with the executable jar.
  • New docker CI job (needs build-test): builds the image and verifies every AC - two stages + distroless base, nonroot user (docker inspect), size < 300 MB, a runnable smoke (Starting LedgerApplication under java 21, full boot deferred to docker-compose ledger smoke test (healthy < 30s) #66 compose), and a Trivy image scan for CRITICAL (ECR DB mirror, no push).

Notes

Gate chain: analyst spec, architect plan, critic GO-WITH-CHANGES (3 changes folded in: fail-on-grep-miss smoke, plain-jar-independent copy, explicit Trivy ECR env).

Closes #63

@tanya_r added 2 commits June 16, 2026 09:03
Add a root Dockerfile with a temurin 21 builder stage that produces the
ledger bootJar and a gcr.io/distroless/java21-debian12:nonroot runtime
stage carrying only the jar, running rootless on port 8080. Add a docker
ci job that builds the image and asserts the two named stages, the
nonroot user, an under-300mb size, a runnable smoke (spring boot starts
under java 21), and a trivy image scan with no critical findings. The
existing build-test and security jobs are unchanged.

Closes #63
The new distroless image trivy gate found 4 critical cves in the boot
3.5.2 dependency tree: tomcat-embed-core 10.1.42 (CVE-2026-41293,
CVE-2026-43512, CVE-2026-43515) and spring-security-web 6.5.1
(CVE-2026-22732). Boot 3.5.15 brings tomcat 10.1.55 and
spring-security 6.5.11, clearing all four. Local test/detekt/spotless
green.
@tiana-code
tiana-code merged commit 0c61d6a into main Jun 16, 2026
7 checks passed
@tiana-code
tiana-code deleted the feat/E-01-dockerfile branch June 16, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add multi-stage distroless Dockerfile

1 participant