CI Perf Lint

jvm-production-image-uses-jdk-runtime

What It Does

Detects Dockerfiles where the final production/runtime stage uses a full JDK base image even though it only runs a Java application.

Why It Matters

A JDK includes development tools (compilers, debuggers, profilers, keytool, etc.) that are unnecessary in production runtime images. Keeping them in the final image increases:

Detection Logic

All of the following must be true:

1. Repository contains Dockerfile build targets (detected via workflow build steps).

2. Final Dockerfile stage uses a JDK-like base image, for example:

3. Final stage runs a Java application:

4. Final stage does not appear to need JDK tools:

Non-Triggers

Severity

warning — image size and security optimization

Score Boosters

Higher score when any of these are detected:

Advisory

Always verify the base image tag is correct before switching. Some distributions share the same tag name for JDK and JRE variants (e.g., eclipse-temurin:17 is JRE while openjdk:17 is JDK). Measure image size, push/pull time, and vulnerability scan results before adopting the change.