Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ARM64 Java in JDK17 Bullseye #310

Merged
merged 10 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions 17/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +41,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM debian:bullseye-20221024
FROM debian:bullseye-20221024 AS build

ARG VERSION=3071.v7e9b_0dc08466
ARG user=jenkins
Expand Down Expand Up @@ -64,7 +71,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}
Expand All @@ -75,10 +81,16 @@ 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"
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
27 changes: 24 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ group "linux" {
"archlinux_jdk11",
"debian_jdk11",
"debian_jdk17",
"debian_jdk17_arm32"
]
}

Expand All @@ -18,7 +19,7 @@ group "linux-arm64" {
group "linux-arm32" {
targets = [
"debian_jdk11",
"debian_jdk17",
"debian_jdk17_arm32"
]
}

Expand Down Expand Up @@ -143,14 +144,34 @@ 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": "",
"${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", "linux/arm/v7"]
platforms = ["linux/arm/v7"]
}