-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters