-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
54 lines (42 loc) · 2.24 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
42
43
44
45
46
47
48
49
50
51
52
53
54
FROM centos:7
LABEL maintainer="clarsonneur@gmail.com"
ENV JENKINS_HOME=/var/jenkins_home \
JENKINS_UC=https://updates.jenkins-ci.org \
JENKINS_DATA_REF=/usr/share/jenkins/ref
ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
COPY ref/plugins/README.md $JENKINS_DATA_REF/plugins/
COPY ref/init.groovy.d/README.md $JENKINS_DATA_REF/init.groovy.d/
COPY ref/jenkins.start.d/README.md $JENKINS_DATA_REF/jenkins.start.d/
ENV TINI_SHA 066ad710107dc7ee05d3aa6e4974f01dc98f3888
ADD https://github.com/krallin/tini/releases/download/v0.5.0/tini-static /bin/tini
RUN chmod +x /bin/tini && \
echo "$TINI_SHA /bin/tini" | sha1sum -c -
# Jenkins is ran with user `jenkins`, uid = 1000
# If you bind mount a volume from host/volume from a data container,
# ensure you use same uid
# Retrieve list of embedded plugins in jenkins war file
# NOTE: for Jenkins 2.0 or latest, remove the embedded plugins before the feature.lst execution, to avoid plugin duplicates
ARG JENKINS_VERSION=1.642.4
ARG OS=redhat-stable
ADD https://pkg.jenkins.io/$OS/jenkins.repo /etc/yum.repos.d/jenkins.repo
RUN useradd -d "$JENKINS_HOME" -u 1000 -m -s /bin/bash jenkins && \
rpm --import https://pkg.jenkins.io/$OS/jenkins.io.key && \
yum -y install java jenkins-$JENKINS_VERSION unzip git && \
yum clean all
ADD https://github.com/forj-oss/docker-lu/releases/download/0.1/docker-lu /usr/bin/docker-lu
ARG UID
ARG GID
COPY *.sh /usr/local/bin/
ARG JPLUGINS_VERSION=latest
ARG JPLUGINS_URL=https://github.com/forj-oss/jplugins/releases/download/${JPLUGINS_VERSION}/jplugins
ADD $JPLUGINS_URL /usr/local/bin/jplugins
RUN chmod +rx /usr/local/bin/jplugins /usr/bin/docker-lu && \
unzip -jd $JENKINS_DATA_REF/plugins /usr/lib/jenkins/jenkins.war WEB-INF/*plugins/*.hpi && \
/usr/local/bin/jplugins list-installed --jenkins-home=$JENKINS_DATA_REF --save-pre-installed && \
rm -f $JENKINS_DATA_REF/plugins/*.hpi && \
printf "$JENKINS_VERSION" > $JENKINS_DATA_REF/jenkins.install.UpgradeWizard.state && \
printf "$JENKINS_VERSION" > $JENKINS_DATA_REF/jenkins.install.InstallUtil.lastExecVersion && \
chown -R jenkins $JENKINS_HOME $JENKINS_DATA_REF
VOLUME /var/jenkins_home
EXPOSE 8080 8443 50000
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/entrypoint.sh" ]