# Runtime-only update for an existing Jenkins controller or trusted agent image.
# BASE_IMAGE must be a local rollback tag verified against the running image ID.
# The final image retains the application's version, tools, plugins and user.
ARG BASE_IMAGE
FROM eclipse-temurin:21.0.13.1_2-jdk-jammy@sha256:4b3d0998ee65462bd86ff060c87119b3575294cb3d0927372afa6f3708b0c8db AS patched_java
FROM ${BASE_IMAGE}
USER root
RUN rm -rf /opt/java/openjdk
COPY --from=patched_java /opt/java/openjdk /opt/java/openjdk
ENV JAVA_VERSION=jdk-21.0.13.1+2
USER jenkins
RUN java -version
