Skip to content

Commit

Permalink
Add java 17 preview (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Sep 26, 2021
1 parent bf132a0 commit 83bff47
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
59 changes: 59 additions & 0 deletions 17/bullseye/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM eclipse-temurin:17_35-jdk-focal AS jre-build

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
# while still saving space
RUN jlink \
--add-modules ALL-MODULE-PATH \
--no-man-pages \
--compress=2 \
--output /javaruntime

FROM debian:bullseye

ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
ARG JENKINS_AGENT_HOME=/home/${user}

ENV JENKINS_AGENT_HOME ${JENKINS_AGENT_HOME}

RUN groupadd -g ${gid} ${group} \
&& useradd -d "${JENKINS_AGENT_HOME}" -u "${uid}" -g "${gid}" -m -s /bin/bash "${user}"

# setup SSH server
RUN apt-get update \
&& apt-get install --no-install-recommends -y openssh-server \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i /etc/ssh/sshd_config \
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
-e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
-e 's/#PasswordAuthentication.*/PasswordAuthentication no/' \
-e 's/#SyslogFacility.*/SyslogFacility AUTH/' \
-e 's/#LogLevel.*/LogLevel INFO/' && \
mkdir /var/run/sshd

VOLUME "${JENKINS_AGENT_HOME}" "/tmp" "/run" "/var/run"
WORKDIR "${JENKINS_AGENT_HOME}"

ENV LANG C.UTF-8

ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

RUN echo "PATH=${PATH}" >> /etc/environment
COPY setup-sshd /usr/local/bin/setup-sshd

EXPOSE 22

ENTRYPOINT ["setup-sshd"]

LABEL \
org.opencontainers.image.vendor="Jenkins project" \
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" \
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" \
org.opencontainers.image.url="https://www.jenkins.io/" \
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" \
org.opencontainers.image.licenses="MIT"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The image has several supported configurations, which can be accessed via the fo

* `latest`, `latest-jdk11`, `jdk11`, `latest-bullseye-jdk11`, `bullseye-jdk11`, `${IMAGE_VERSION}`, `${IMAGE_VERSION}-jdk11`, ([Dockerfile](11/bullseye/Dockerfile))
* `latest-jdk8`, `jdk8`, `latest-bullseye-jdk8`, `bullseye-jdk8`, `${IMAGE_VERSION}-jdk8`, ([Dockerfile](8/bullseye/Dockerfile))
* `latest-jdk17-preview`, `jdk17-preview`, `latest-bullseye-jdk17-preview`, `bullseye-jdk17-preview`, `${IMAGE_VERSION}-jdk17-preview`, ([Dockerfile](17/bullseye/Dockerfile))
* `latest-alpine-jdk8`, `alpine-jdk8`, `${IMAGE_VERSION}-jdk8`, ([Dockerfile](8/alpine/Dockerfile))
* `nanoserver-1809`, `nanoserver-ltsc2019`, `nanoserver-1809-jdk11`, `nanoserver-ltsc2019-jdk11`, `${IMAGE_VERSION}-nanoserver-1809`, `${IMAGE_VERSION}-nanoserver-ltsc2019`, `${IMAGE_VERSION}-nanoserver-1809-jdk11`, `${IMAGE_VERSION}-nanoserver-ltsc2019-jdk11` ([Dockerfile](11/windows/nanoserver-ltsc2019/Dockerfile))
* `nanoserver-1809-jdk8`, `nanoserver-ltsc2019-jdk8`, `${IMAGE_VERSION}-nanoserver-1809-jdk8`, `${IMAGE_VERSION}-nanoserver-ltsc2019-jdk8` ([Dockerfile](8/windows/nanoserver-ltsc2019/Dockerfile))
Expand Down
15 changes: 15 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ group "linux" {
"alpine_jdk8",
"debian_jdk8",
"debian_jdk11",
"debian_jdk17",
]
}

group "linux-arm64" {
targets = [
"debian_jdk11",
"debian_jdk17",
]
}

Expand Down Expand Up @@ -76,3 +78,16 @@ target "debian_jdk11" {
]
platforms = ["linux/amd64", "linux/arm64", "linux/s390x"]
}

target "debian_jdk17" {
dockerfile = "17/bullseye/Dockerfile"
context = "."
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-jdk17-preview": "",
"${REGISTRY}/${JENKINS_REPO}:bullseye-jdk17-preview",
"${REGISTRY}/${JENKINS_REPO}:jdk17-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-bullseye-jdk17-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-jdk17-preview",
]
platforms = ["linux/amd64", "linux/arm64"]
}
2 changes: 1 addition & 1 deletion tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ AGENT_CONTAINER=bats-jenkins-ssh-agent
run_through_ssh "${test_container_name}" java -version
fi
assert_success
assert_output --regexp '^openjdk version \"[[:digit:]]+\.'
assert_output --regexp '^openjdk version \"[[:digit:]]+'

clean_test_container "${test_container_name}"
}
Expand Down

0 comments on commit 83bff47

Please sign in to comment.