-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
41 lines (35 loc) · 1.48 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM eclipse-temurin:17-jre-jammy
LABEL maintainer="Alex Simenduev <[email protected]>"
# Those are allowed to be changed at build time
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
ARG git_lfs_version=3.4.0
ENV JENKINS_HOME=/var/jenkins_home \
JENKINS_USER=${user}
RUN apt-get update \
&& apt-get install -y --no-install-recommends dumb-init git libltdl7 openssh-client \
&& rm -rf /var/lib/apt/lists/* \
\
# Install git LFS
&& curl -#LSo git-lfs.deb https://packagecloud.io/github/git-lfs/packages/debian/bullseye/git-lfs_${git_lfs_version}_amd64.deb/download.deb \
&& dpkg -i git-lfs.deb \
&& rm -f git-lfs.deb \
\
# Jenkins is run with user `jenkins`, uid = 1000
# If you bind mount a volume from the host or a data container,
# ensure you use the same uid
&& groupadd -g ${gid} ${group} \
&& useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user} \
\
# Tweak global SSH client configuration
&& sed -i '/^Host \*/a \ \ \ \ ServerAliveInterval 30' /etc/ssh/ssh_config \
&& sed -i '/^Host \*/a \ \ \ \ StrictHostKeyChecking no' /etc/ssh/ssh_config \
&& sed -i '/^Host \*/a \ \ \ \ UserKnownHostsFile /dev/null' /etc/ssh/ssh_config
# Jenkins home directory is a volume, so configuration and build history
# can be persisted and survive image upgrades
VOLUME $JENKINS_HOME
COPY jenkins-agent /usr/local/bin/jenkins-agent
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/local/bin/jenkins-agent"]