Skip to content

Use dpkg-tracked OpenJDK 25 runtime base images - #3280

Open
CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:dpkg-openjdk25-dockerfiles
Open

CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:dpkg-openjdk25-dockerfiles

Conversation

@CydeWeys

@CydeWeys CydeWeys commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Migrate core/Dockerfile, proxy/Dockerfile, and jetty/Dockerfile off
tarball-based Docker Hub JDK images (eclipse-temurin:25 and
jetty:12-jdk25) onto a shared launcher.gcr.io/google/ubuntu2404 base
layer installing openjdk-25-jre-headless via apt-get:

  • Register OpenJDK 25 and OS packages in /var/lib/dpkg/status so GCP
    Artifact Analysis natively inventories the JVM runtime as an OS
    package across nomulus, proxy, and nomulus-tool, while sharing
    the cached JRE layer and supporting unauthenticated CI builds.
  • Stage Jetty Home through Gradle instead of downloading it in
    jetty/Dockerfile. org.eclipse.jetty:jetty-home is declared in
    dependencies.gradle and locked in jetty/gradle.lockfile (12.1.15),
    so it is fetched from the configured Maven repository like every other
    dependency. The new :jetty:unpackJettyHome task unpacks it into
    build/jetty-home for the image and for :jetty:run, which now falls
    back to it when JETTY_HOME is unset.
  • Install the Cloud Profiler Java agent under a non-root jetty:jetty
    user in jetty/Dockerfile, preserving all runtime paths, permissions,
    and -XX:-UseBASE64Intrinsics flags.
  • Update release/prepare_release_tree.sh,
    release/cloudbuild-release.yaml,
    release/cloudbuild-nomulus-images.yaml, and
    release/cloudbuild-proxy-images.yaml to mirror and digest-pin the
    shared ubuntu2404 base image across core, proxy, and jetty.
  • Add release/prepare_release_tree_test.sh and wire it into
    config/presubmits.py.
  • Refresh all Gradle lockfiles (Jetty 12.1.15, Beam 2.78.0, Netty
    4.2.21, gRPC 1.85.1, Jackson 2.23.0, Flyway 13.12.2, and others).
  • Disable Selenium's OpenTelemetry tracing in :core:fragileTest. Beam
    2.78.0 adds its GCP auth OpenTelemetry extension to the classpath,
    which otherwise fails RemoteWebDriver setup without a Google Cloud
    project ID.

BUG= http://b/587432676


This change is Reviewable

Comment thread jetty/Dockerfile Outdated
&& rm -rf /var/lib/apt/lists/*

USER root
# Keep JETTY_VERSION and JETTY_SHA256 aligned with org.eclipse.jetty in

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is nothing more than a wish. It sure would be nice if we didn't have to remember to keep these up to date with each other, and could specify versions in only one place. Thoughts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — "please remember to update X when updating Y" comments inevitably rot.
(Ironically, FROM jetty:12-jdk25 previously had the inverse problem: it
silently floated across whatever 12.x minor release Docker Hub published,
drifting away from org.eclipse.jetty:* in core/gradle.lockfile without
anyone noticing.)

We can eliminate the duplicate version/checksum completely by having Gradle
stage jetty-home from dependencies.gradle:

  1. Declare jetty-home in dependencies.gradle: Maven Central publishes
    the exact distribution tarball we're fetching here as
    org.eclipse.jetty:jetty-home:[12.0.0,)@tar.gz. Because dependencyMap keys
    on group:name, checkDependenciesDotGradle handles @tar.gz artifacts
    cleanly.
  2. Unpack it in jetty/build.gradle: Add a non-transitive jettyHome
    configuration (transitive = false, automatically locked in
    jetty/gradle.lockfile via root lockAllConfigurations()) and unpack the
    tarball into build/jetty-home during :jetty:stage (plus exclude the
    non-JAR tarball configuration in dependency_lic.gradle and sync the
    .tar.gz artifact once via our GCS Maven mirror sync script).
  3. Copy from context in jetty/Dockerfile: Replace JETTY_VERSION,
    JETTY_SHA256, apt-get install wget, and the repo1.maven.org download
    with ADD --chown=jetty:jetty build/jetty-home /usr/local/jetty.

That gives us a single version workflow (./gradlew dependencies --write-locks --update-locks '*:*'), removes the live Maven Central network call from
docker build (using our offline GCS Maven mirror instead), and as a bonus
lets :jetty:run use build/jetty-home/start.jar instead of requiring
developers to set JETTY_HOME locally.

(Lighter fallback: a 10-line check in config/presubmits.py asserting
JETTY_VERSION in jetty/Dockerfile matches org.eclipse.jetty:jetty-server
in core/gradle.lockfile — catches drift in CI, though you still have to
manually bump the SHA-256 on upgrades.)

Staging jetty-home via Gradle seems strictly cleaner. Happy to either fold
that into this PR or send it as an immediate follow-up PR — which do you prefer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. This PR is now rebased on master, and Jetty Home is specified in only one place. org.eclipse.jetty:jetty-home is declared in dependencies.gradle and locked in jetty/gradle.lockfile (12.1.15) like every other dependency. The new :jetty:unpackJettyHome task stages it into build/jetty-home, and the Dockerfile ADDs it. JETTY_VERSION, JETTY_SHA256, and the Maven Central download are gone from the Dockerfile, so it can no longer drift from the lockfile.

@CydeWeys

Copy link
Copy Markdown
Member Author

Is this overall more maintainable and the more supported, well-lit path for how to handle these containers generally?

@CydeWeys

Copy link
Copy Markdown
Member Author

Is this overall more maintainable and the more supported, well-lit path for
how to handle these containers generally?

Candidly: compared to where we were (eclipse-temurin:25 + jetty:12-jdk25
from Docker Hub), yes; compared to the broader GCP/GKE Java ecosystem, this is
a pragmatic middle ground rather than the canonical endgame.
Here is how the
options compare in practice:

1. Why this PR is a step forward over eclipse-temurin + jetty

  • OS scanner visibility: Official eclipse-temurin and jetty images
    unpack JDK tarballs under /opt/java/openjdk outside dpkg, leaving the JVM
    invisible to OS package scanners like GCP Artifact Analysis. Installing
    openjdk-25-jre-headless via apt registers the Ubuntu security-patched
    package in /var/lib/dpkg/status (and drops the full JDK toolchain down to a
    headless JRE).
  • Single first-party base: All three runtime images (nomulus, proxy,
    nomulus-tool) now share launcher.gcr.io/google/ubuntu2404 (already used by
    release/builder) instead of pulling two third-party Docker Hub images
    subject to pull rate limits and floating tag rebuilds.

2. What the canonical "well-lit path" on GCP looks like (Distroless + Jib)

For Java services on GKE generally, Google's most well-lit path is Jib
(com.google.cloud.tools.jib) + Distroless
:

  • Java 25 availability today: gcr.io/distroless/java25-debian13:nonroot
    (aliased as gcr.io/distroless/java25:nonroot) is live now (java25-debian12
    does not exist; the java25 track started on Debian 13 and bundles Eclipse
    Adoptium's temurin-25-jre .deb plus libc6/libstdc++6 across just 23
    total packages recorded in /var/lib/dpkg/status.d/).
  • Pros: Strips bash, apt, and ~85% of OS userland packages (dramatically
    cutting unrelated OS CVE noise), retains /var/lib/dpkg/status.d/ metadata
    for Artifact Analysis, and builds deterministic layered images directly from
    Gradle without a Docker daemon or build-time apt-get network calls.
  • Caveats for Nomulus:
    • proxy and nomulus-tool (core): Pure java -jar entrypoints
      (java25-debian13 already includes libc6/libstdc++6 for proxy's
      netty-tcnative-boringssl-static), so both could adopt Jib + Distroless
      cleanly.
    • nomulus (jetty): Currently invokes /bin/bash /start.sh (cp,
      find, rm) at startup to stage webapps/console-${env} into
      webapps/console and attach /opt/cprof/profiler_java_agent.so.
      Distroless has no shell, so moving nomulus to Distroless would first
      require moving environment console selection out of start.sh into
      Java/Jetty configuration (and staging the profiler .so at build time).
    • Scanner nuance: Because distroless/java25-debian13 ships Adoptium's
      temurin-25-jre package rather than Debian's native openjdk-25 package,
      it relies on scanner support for Adoptium/Java binary metadata rather than
      Canonical/Debian's native openjdk-25 OS USN feed.

3. Two concrete refinements if we keep ubuntu2404 + openjdk-25-jre

If we stay on ubuntu2404 (either for operational uniformity across all three
services + builder, or while jetty still uses start.sh), two follow-ups
would remove the remaining rough edges in this PR:

  1. Build and digest-pin one shared jre-base image in
    cloudbuild-release.yaml:
    Right now, core, proxy, and jetty each run
    apt-get update && apt-get upgrade -y && apt-get install ... openjdk-25-jre-headless independently during image builds. Building a single
    release/jre-base/Dockerfile once per release (just like release/builder),
    pushing gcr.io/${PROJECT_ID}/jre-base:${TAG_NAME}, and digest-pinning all
    three service Dockerfiles to jre-base@sha256:... eliminates 3x duplicated
    apt runs and guarantees bit-for-bit identical OS/JRE packages across the
    release without live apt mirror drift.
  2. Stage jetty-home via Gradle (dependencies.gradle): As noted on the
    jetty/Dockerfile thread, unpacking org.eclipse.jetty:jetty-home in Gradle
    eliminates JETTY_VERSION/JETTY_SHA256 drift and removes the build-time
    repo1.maven.org fetch.

Recommendation

  • Near term: Keep the unified ubuntu2404 + openjdk-25-jre-headless
    direction to unblock OS-level JVM scanning immediately, and follow up with
    (1) Gradle-staged jetty-home and (2) a single release-pinned
    jre-base image
    .
  • Longer term: If we want minimal OS CVE surface and daemonless builds,
    migrate proxy and nomulus-tool to Jib +
    gcr.io/distroless/java25-debian13:nonroot first, then follow with nomulus
    once start.sh's console-${env} directory shuffle is replaced in Java.

Migrate core/Dockerfile, proxy/Dockerfile, and jetty/Dockerfile off
tarball-based Docker Hub JDK images (eclipse-temurin:25 and
jetty:12-jdk25) onto a shared launcher.gcr.io/google/ubuntu2404 base
layer installing openjdk-25-jre-headless via apt-get:

- Register OpenJDK 25 and OS packages in /var/lib/dpkg/status so GCP
  Artifact Analysis natively inventories the JVM runtime as an OS
  package across nomulus, proxy, and nomulus-tool, while sharing the
  cached JRE layer and supporting unauthenticated CI builds.
- Stage Jetty Home through Gradle instead of downloading it in
  jetty/Dockerfile. org.eclipse.jetty:jetty-home is declared in
  dependencies.gradle and locked in jetty/gradle.lockfile (12.1.15), so
  it is fetched from the configured Maven repository like every other
  dependency. The new :jetty:unpackJettyHome task unpacks it into
  build/jetty-home for the image and for :jetty:run, which now falls
  back to it when JETTY_HOME is unset.
- Install the Cloud Profiler Java agent under a non-root jetty:jetty
  user in jetty/Dockerfile, preserving all runtime paths, permissions,
  and -XX:-UseBASE64Intrinsics flags.
- Update release/prepare_release_tree.sh,
  release/cloudbuild-release.yaml,
  release/cloudbuild-nomulus-images.yaml, and
  release/cloudbuild-proxy-images.yaml to mirror and digest-pin the
  shared ubuntu2404 base image across core, proxy, and jetty.
- Add release/prepare_release_tree_test.sh and wire it into
  config/presubmits.py.
- Refresh all Gradle lockfiles (Jetty 12.1.15, Beam 2.78.0, Netty
  4.2.21, gRPC 1.85.1, Jackson 2.23.0, Flyway 13.12.2, and others).
- Disable Selenium's OpenTelemetry tracing in :core:fragileTest. Beam
  2.78.0 adds its GCP auth OpenTelemetry extension to the classpath,
  which otherwise fails RemoteWebDriver setup without a Google Cloud
  project ID.

BUG= http://b/587432676
@CydeWeys
CydeWeys force-pushed the dpkg-openjdk25-dockerfiles branch from d616b79 to eb7e9c0 Compare November 19, 2026 00:09

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Attention Required: Lockfile Detected

This pull request contains modifications to one or more *.lockfile files. Please confirm that you have run update_dependency.sh to push new dependencies to the private repo.

Someone with Admin role must manually dismiss this review before merging.

This branch has not been deployed

No deployments
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.

1 participant