From f71ac23d8a3bdbc468a54db30d3bf33a002b0aa6 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Mon, 31 Oct 2022 15:41:38 -0400 Subject: [PATCH 01/10] Fix JDK17 bullseye java --- 17/bullseye/Dockerfile | 21 ++++++++++++++++++--- docker-bake.hcl | 27 ++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index 3399ffa82..708a04844 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -21,7 +21,14 @@ # THE SOFTWARE. # To avoid "jmods: Value too large for defined data type" error, -FROM --platform=$BUILDPLATFORM eclipse-temurin:17.0.4.1_1-jdk-focal AS jre-build +# Check docker bake target debian_jdk17_arm32 +# Cannot get jlink to properly work, in the v7 environment. The jmods error +# above gets generated each time. Better to have a larger image than +# incorrect java binaries in 32bit arm. +FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS arm32-jre-build +RUN cp -r /opt/java/openjdk /javaruntime + +FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS jre-build # Generate smaller java runtime without unneeded files # for now we include the full module path to maintain compatibility @@ -34,7 +41,8 @@ RUN jlink \ --compress=2 \ --output /javaruntime -FROM debian:bullseye-20221024 + +FROM debian:bullseye-20221024 as build ARG VERSION=3071.v7e9b_0dc08466 ARG user=jenkins @@ -64,7 +72,6 @@ ENV LANG C.UTF-8 ENV JAVA_HOME=/opt/java/openjdk ENV PATH "${JAVA_HOME}/bin:${PATH}" -COPY --from=jre-build /javaruntime $JAVA_HOME USER ${user} ENV AGENT_WORKDIR=${AGENT_WORKDIR} @@ -74,6 +81,14 @@ VOLUME /home/${user}/.jenkins VOLUME ${AGENT_WORKDIR} WORKDIR /home/${user} + +FROM build as default +COPY --from=jre-build /javaruntime $JAVA_HOME + +FROM build as arm32 +COPY --from=arm32-jre-build /javaruntime $JAVA_HOME + + LABEL \ org.opencontainers.image.vendor="Jenkins project" \ org.opencontainers.image.title="Official Jenkins Agent Base Docker image" \ diff --git a/docker-bake.hcl b/docker-bake.hcl index 2a2cdff0f..2d7fe2b9e 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -5,6 +5,7 @@ group "linux" { "archlinux_jdk11", "debian_jdk11", "debian_jdk17", + "debian_jdk17_arm32" ] } @@ -18,7 +19,7 @@ group "linux-arm64" { group "linux-arm32" { targets = [ "debian_jdk11", - "debian_jdk17", + "debian_jdk17_arm32" ] } @@ -139,11 +140,31 @@ target "debian_jdk11" { platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x"] } + + target "debian_jdk17" { dockerfile = "17/bullseye/Dockerfile" context = "." args = { - VERSION = REMOTING_VERSION + VERSION = REMOTING_VERSION, + target = "default" + } + tags = [ + equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk17": "", + "${REGISTRY}/${JENKINS_REPO}:bullseye-jdk17", + "${REGISTRY}/${JENKINS_REPO}:jdk17", + "${REGISTRY}/${JENKINS_REPO}:latest-bullseye-jdk17", + "${REGISTRY}/${JENKINS_REPO}:latest-jdk17", + ] + platforms = ["linux/amd64", "linux/arm64"] +} + +target "debian_jdk17_arm32" { + dockerfile = "17/bullseye/Dockerfile" + context = "." + args = { + VERSION = REMOTING_VERSION, + target = "arm32" } tags = [ equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk17": "", @@ -152,5 +173,5 @@ target "debian_jdk17" { "${REGISTRY}/${JENKINS_REPO}:latest-bullseye-jdk17", "${REGISTRY}/${JENKINS_REPO}:latest-jdk17", ] - platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"] + platforms = ["linux/arm/v7"] } From 05215cc21ba0a5b3f4930f2f665c9869f432a368 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Tue, 1 Nov 2022 10:26:49 -0400 Subject: [PATCH 02/10] Update 17/bullseye/Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com> --- 17/bullseye/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index 708a04844..e08ab9d6c 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -22,11 +22,11 @@ # To avoid "jmods: Value too large for defined data type" error, # Check docker bake target debian_jdk17_arm32 -# Cannot get jlink to properly work, in the v7 environment. The jmods error -# above gets generated each time. Better to have a larger image than -# incorrect java binaries in 32bit arm. -FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS arm32-jre-build -RUN cp -r /opt/java/openjdk /javaruntime +# Cannot get jlink to properly work, in the v7 environment. +# The jmods error above gets generated each time. +# Better to have a larger image than incorrect java binaries in 32bit arm. +FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS arm32-jre-build +RUN cp -r /opt/java/openjdk /javaruntime FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS jre-build From f18e392fc239bc68bb729d3f6c9e6099c8689dc6 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Tue, 1 Nov 2022 10:27:05 -0400 Subject: [PATCH 03/10] Update 17/bullseye/Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com> --- 17/bullseye/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index e08ab9d6c..b903e4e0a 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -41,7 +41,6 @@ RUN jlink \ --compress=2 \ --output /javaruntime - FROM debian:bullseye-20221024 as build ARG VERSION=3071.v7e9b_0dc08466 From 159656294c6e55aeaa9ff31f8c264e6533116c5d Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Tue, 1 Nov 2022 10:27:13 -0400 Subject: [PATCH 04/10] Update docker-bake.hcl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com> --- docker-bake.hcl | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 2d7fe2b9e..b47900361 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -140,8 +140,6 @@ target "debian_jdk11" { platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/s390x"] } - - target "debian_jdk17" { dockerfile = "17/bullseye/Dockerfile" context = "." From 6c4b6a687d5348694e358f9be0d9067ac8910a0e Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Tue, 1 Nov 2022 10:27:41 -0400 Subject: [PATCH 05/10] Update 17/bullseye/Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com> --- 17/bullseye/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index b903e4e0a..0403ad4a3 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -80,14 +80,12 @@ VOLUME /home/${user}/.jenkins VOLUME ${AGENT_WORKDIR} WORKDIR /home/${user} - FROM build as default COPY --from=jre-build /javaruntime $JAVA_HOME FROM build as arm32 COPY --from=arm32-jre-build /javaruntime $JAVA_HOME - LABEL \ org.opencontainers.image.vendor="Jenkins project" \ org.opencontainers.image.title="Official Jenkins Agent Base Docker image" \ From be1e8390ad33a30e441292ac343a974f2a4aeb0b Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Wed, 2 Nov 2022 15:02:54 -0400 Subject: [PATCH 06/10] Update 17/bullseye/Dockerfile Co-authored-by: Bruno Verachten --- 17/bullseye/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index 0403ad4a3..6399c4d3b 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -41,7 +41,7 @@ RUN jlink \ --compress=2 \ --output /javaruntime -FROM debian:bullseye-20221024 as build +FROM debian:bullseye-20221024 AS build ARG VERSION=3071.v7e9b_0dc08466 ARG user=jenkins From a256f401246cc0ec600c0ae9fb2703269607b499 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Wed, 2 Nov 2022 15:03:13 -0400 Subject: [PATCH 07/10] Update 17/bullseye/Dockerfile Co-authored-by: Bruno Verachten --- 17/bullseye/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index 6399c4d3b..b6c4940a6 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -80,7 +80,7 @@ VOLUME /home/${user}/.jenkins VOLUME ${AGENT_WORKDIR} WORKDIR /home/${user} -FROM build as default +FROM build AS default COPY --from=jre-build /javaruntime $JAVA_HOME FROM build as arm32 From fd1c987a2bfa8b6e8363bc9773cef676e989bd73 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Wed, 2 Nov 2022 15:03:25 -0400 Subject: [PATCH 08/10] Update 17/bullseye/Dockerfile Co-authored-by: Bruno Verachten --- 17/bullseye/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index b6c4940a6..12932d7d9 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -83,7 +83,7 @@ WORKDIR /home/${user} FROM build AS default COPY --from=jre-build /javaruntime $JAVA_HOME -FROM build as arm32 +FROM build AS arm32 COPY --from=arm32-jre-build /javaruntime $JAVA_HOME LABEL \ From 2064967155953d86e88416333c69202361d26691 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Wed, 2 Nov 2022 15:11:36 -0400 Subject: [PATCH 09/10] Fixes for PR comments --- 17/bullseye/Dockerfile | 36 ++++++++++++++++++------------------ docker-bake.hcl | 6 ++++-- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index 12932d7d9..e97c3f72c 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -34,12 +34,12 @@ FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS jre-build # for now we include the full module path to maintain compatibility # while still saving space (approx 200mb from the full distribution) RUN jlink \ - --add-modules ALL-MODULE-PATH \ - --strip-java-debug-attributes \ - --no-man-pages \ - --no-header-files \ - --compress=2 \ - --output /javaruntime + --add-modules ALL-MODULE-PATH \ + --strip-java-debug-attributes \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /javaruntime FROM debian:bullseye-20221024 AS build @@ -57,9 +57,9 @@ ARG AGENT_WORKDIR=/home/${user}/agent RUN apt-get update \ && apt-get -y install \ - git-lfs \ - curl \ - fontconfig \ + git-lfs \ + curl \ + fontconfig \ && curl --create-dirs -fsSLo /usr/share/jenkins/agent.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar \ && chmod 755 /usr/share/jenkins \ && chmod 644 /usr/share/jenkins/agent.jar \ @@ -80,17 +80,17 @@ VOLUME /home/${user}/.jenkins VOLUME ${AGENT_WORKDIR} WORKDIR /home/${user} +LABEL \ + org.opencontainers.image.vendor="Jenkins project" \ + org.opencontainers.image.title="Official Jenkins Agent Base Docker image" \ + org.opencontainers.image.description="This is a base image, which provides the Jenkins agent executable (agent.jar)" \ + org.opencontainers.image.version="${VERSION}" \ + org.opencontainers.image.url="https://www.jenkins.io/" \ + org.opencontainers.image.source="https://github.com/jenkinsci/docker-agent" \ + org.opencontainers.image.licenses="MIT" + FROM build AS default COPY --from=jre-build /javaruntime $JAVA_HOME FROM build AS arm32 COPY --from=arm32-jre-build /javaruntime $JAVA_HOME - -LABEL \ - org.opencontainers.image.vendor="Jenkins project" \ - org.opencontainers.image.title="Official Jenkins Agent Base Docker image" \ - org.opencontainers.image.description="This is a base image, which provides the Jenkins agent executable (agent.jar)" \ - org.opencontainers.image.version="${VERSION}" \ - org.opencontainers.image.url="https://www.jenkins.io/" \ - org.opencontainers.image.source="https://github.com/jenkinsci/docker-agent" \ - org.opencontainers.image.licenses="MIT" diff --git a/docker-bake.hcl b/docker-bake.hcl index b47900361..c41a3bbe6 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -145,8 +145,9 @@ target "debian_jdk17" { context = "." args = { VERSION = REMOTING_VERSION, - target = "default" + } + target = "default" tags = [ equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk17": "", "${REGISTRY}/${JENKINS_REPO}:bullseye-jdk17", @@ -162,8 +163,9 @@ target "debian_jdk17_arm32" { context = "." args = { VERSION = REMOTING_VERSION, - target = "arm32" + } + target = "arm32" tags = [ equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk17": "", "${REGISTRY}/${JENKINS_REPO}:bullseye-jdk17", From ad341bafc429218e59dc35744e8b4151cbc58232 Mon Sep 17 00:00:00 2001 From: Nick Carpenter Date: Wed, 2 Nov 2022 15:15:06 -0400 Subject: [PATCH 10/10] Whitespace --- 17/bullseye/Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/17/bullseye/Dockerfile b/17/bullseye/Dockerfile index e97c3f72c..ec1629a16 100644 --- a/17/bullseye/Dockerfile +++ b/17/bullseye/Dockerfile @@ -34,12 +34,12 @@ FROM eclipse-temurin:17.0.4.1_1-jdk-focal AS jre-build # for now we include the full module path to maintain compatibility # while still saving space (approx 200mb from the full distribution) RUN jlink \ - --add-modules ALL-MODULE-PATH \ - --strip-java-debug-attributes \ - --no-man-pages \ - --no-header-files \ - --compress=2 \ - --output /javaruntime + --add-modules ALL-MODULE-PATH \ + --strip-java-debug-attributes \ + --no-man-pages \ + --no-header-files \ + --compress=2 \ + --output /javaruntime FROM debian:bullseye-20221024 AS build @@ -57,9 +57,9 @@ ARG AGENT_WORKDIR=/home/${user}/agent RUN apt-get update \ && apt-get -y install \ - git-lfs \ - curl \ - fontconfig \ + git-lfs \ + curl \ + fontconfig \ && curl --create-dirs -fsSLo /usr/share/jenkins/agent.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar \ && chmod 755 /usr/share/jenkins \ && chmod 644 /usr/share/jenkins/agent.jar \