-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.Slave
45 lines (37 loc) · 1.66 KB
/
Dockerfile.Slave
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
42
43
44
45
FROM ubuntu:bionic
USER root
RUN apt-get -q update && \
apt-get upgrade -yqq
RUN apt-get install -yqq openjdk-11-jdk curl gnupg2
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" >> /etc/apt/sources.list \
&& apt-get -q update
RUN apt-get install -yqq docker-ce
ARG VERSION=4.7
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
RUN groupadd -g ${gid} ${group}
RUN newgrp docker
RUN useradd -c "Jenkins user" -d /home/${user} -u ${uid} -g ${gid} -G docker -m ${user}
ARG AGENT_WORKDIR=/home/${user}/agent
RUN apt update && apt install -y git-lfs
RUN 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 \
&& ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar
COPY jenkins-agent /usr/local/bin/jenkins-agent
RUN chmod +x /usr/local/bin/jenkins-agent &&\
ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave
USER ${user}
ENV AGENT_WORKDIR=${AGENT_WORKDIR}
RUN mkdir /home/${user}/.jenkins && mkdir -p ${AGENT_WORKDIR}
VOLUME /home/${user}/.jenkins
VOLUME ${AGENT_WORKDIR}
WORKDIR /home/${user}
ENTRYPOINT ["jenkins-agent"]
LABEL org.label-schema.name="derrickwalton/jnlp-jenkins-slave" \
org.label-schema.description="This is an ubuntu based jnlp slave for jenkins" \
org.label-schema.url="https://github.com/plainenough/jenkins.git" \
org.label-schema.vendor="Tosstalk.com" \
org.label-schema.version=${VERSION}