blob: 4e60c9297614dd68befffc4f2aba28a71edbf27c [file] [log] [blame]
Carlos Sanchez64c7ca32016-08-15 13:36:55 +02001FROM openjdk:8-jdk
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +01002
azvyagintsev6983fb92018-04-07 16:04:58 +03003LABEL maintainer="dev@mirantis.com"
4
5ENV DEBIAN_FRONTEND=noninteractive \
6 DEBCONF_NONINTERACTIVE_SEEN=true \
7 LANG=C.UTF-8 \
8 LANGUAGE=$LANG
9SHELL ["/bin/bash", "-xec"]
10
11# Base apt config
12RUN cd /etc/apt/ \
13 && echo 'Acquire::Languages "none";' > apt.conf.d/docker-no-languages \
14 && echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > apt.conf.d/docker-gzip-indexes \
15 && echo 'APT::Get::Install-Recommends "false"; APT::Get::Install-Suggests "false";' > apt.conf.d/docker-recommends
16
17RUN apt-get update && apt-get install -y git curl gettext-base python-virtualenv
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010018
19ENV JENKINS_HOME /var/jenkins_home
jeichelaebb8b22015-08-10 12:38:20 -040020ENV JENKINS_SLAVE_AGENT_PORT 50000
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010021
Stig Bakken854a6042016-03-14 17:04:27 +010022ARG user=jenkins
23ARG group=jenkins
24ARG uid=1000
25ARG gid=1000
26
Scott Newson39046ee2015-10-25 03:16:16 -060027# Jenkins is run with user `jenkins`, uid = 1000
Filip Pytloun1e8af362017-03-16 13:58:44 +010028# If you bind mount a volume from the host or a data container,
Scott Newson39046ee2015-10-25 03:16:16 -060029# ensure you use the same uid
Stig Bakken854a6042016-03-14 17:04:27 +010030RUN groupadd -g ${gid} ${group} \
31 && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010032
Filip Pytloun1e8af362017-03-16 13:58:44 +010033# Jenkins home directory is a volume, so configuration and build history
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010034# can be persisted and survive image upgrades
35VOLUME /var/jenkins_home
36
Filip Pytloun1e8af362017-03-16 13:58:44 +010037# `/usr/share/jenkins/ref/` contains all reference configuration we want
38# to set on a fresh new installation. Use it to bundle additional plugins
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010039# or config file with your custom jenkins Docker image.
Filip Pytloune9e6f562016-08-31 16:30:33 +020040RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d; chown ${uid}:${gid} /usr/share/jenkins/ref/init.groovy.d
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010041
muicoderbac415c2017-01-19 13:47:25 +080042ENV TINI_VERSION 0.13.2
43ENV TINI_SHA afbf8de8a63ce8e4f18cb3f34dfdbbd354af68a1
Dionysis Grigoropoulosb5b788c2015-08-12 03:07:53 +030044
Filip Pytloun1e8af362017-03-16 13:58:44 +010045# Use tini as subreaper in Docker container to adopt zombie processes
Thomas Orozcoc0d446e2016-12-05 21:11:25 +010046RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini \
Carlos Sanchezeecaeb22016-04-13 12:10:39 +020047 && echo "$TINI_SHA /bin/tini" | sha1sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010048
Jesse Glickfc9e7102015-04-28 09:37:28 -040049COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010050
Nicolas De loof31bc79c2016-08-04 14:25:22 +020051# jenkins version being bundled in this docker image
Yoanis Gil8fbb91f2016-03-15 21:45:19 -040052ARG JENKINS_VERSION
Jakub Josef415054f2018-01-31 15:21:38 +010053ENV JENKINS_VERSION ${JENKINS_VERSION:-2.104}
jpthiery3eb0f832015-11-12 13:47:35 +010054
Nicolas De loof31bc79c2016-08-04 14:25:22 +020055# jenkins.war checksum, download will be validated using it
Jakub Josef415054f2018-01-31 15:21:38 +010056ARG JENKINS_SHA=51724ecb3c287d13679d9c1bde72552283928b17f49861fe2bfd337fbbfb95a0
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010057
Nicolas De loof31bc79c2016-08-04 14:25:22 +020058# Can be used to customize where jenkins.war get downloaded from
Joe Fergusond187b532016-10-17 16:20:16 -070059ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
Nicolas De loof31bc79c2016-08-04 14:25:22 +020060
Filip Pytloun1e8af362017-03-16 13:58:44 +010061# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010062# see https://github.com/docker/docker/issues/8331
Nicolas De loof31bc79c2016-08-04 14:25:22 +020063RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war \
Jon Hermansen14d338e2017-03-04 07:26:56 -080064 && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha256sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010065
jamesHsiaoAcquiaaa665612016-04-21 10:55:00 -040066ENV JENKINS_UC https://updates.jenkins.io
Stig Bakken854a6042016-03-14 17:04:27 +010067RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010068
69# for main web interface:
70EXPOSE 8080
71
72# will be used by attached slave agents:
73EXPOSE 50000
74
Carlos Sanchezc8c95d12015-07-02 12:36:13 +020075ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
Jesse Glick8cdfb1f2015-04-28 09:32:11 -040076
Jakub Pavlika067c492016-09-01 15:18:03 +020077COPY SimpleThemeDecorator.xml /tmp/org.codefirst.SimpleThemeDecorator.xml
78RUN chown ${user} /tmp/org.codefirst.SimpleThemeDecorator.xml
79
Stig Bakken854a6042016-03-14 17:04:27 +010080USER ${user}
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010081
Vincent Latombec14af952016-07-18 10:20:12 +020082COPY jenkins-support /usr/local/bin/jenkins-support
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010083COPY jenkins.sh /usr/local/bin/jenkins.sh
Nicolas De Loofd5aea672015-07-15 21:53:48 +020084ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010085
Scott Newson39046ee2015-10-25 03:16:16 -060086# from a derived Dockerfile, can use `RUN plugins.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010087COPY plugins.sh /usr/local/bin/plugins.sh
Nicolas De Loofdfe81a32016-05-28 17:26:01 +020088COPY install-plugins.sh /usr/local/bin/install-plugins.sh
Filip Pytlound17c92d2017-03-16 17:50:25 +010089COPY theme /usr/share/jenkins/ref/userContent/theme
Filip Pytloun74ce0b02016-08-31 16:02:16 +020090
Filip Pytloun1e8af362017-03-16 13:58:44 +010091RUN JENKINS_UC_DOWNLOAD=http://archives.jenkins-ci.org /usr/local/bin/install-plugins.sh \
Filip Pytlound903d9a2017-03-16 13:23:05 +010092 artifactory \
Jakub Josef8ba23df2018-01-05 15:31:14 +010093 blueocean \
Filip Pytlound903d9a2017-03-16 13:23:05 +010094 build-blocker-plugin \
95 build-monitor-plugin \
Alexander Evseevd5dbc522017-11-08 18:40:41 +030096 build-timeout \
Filip Pytlound903d9a2017-03-16 13:23:05 +010097 build-user-vars-plugin \
98 categorized-view \
Konstantin Hontarb6cc0d72017-08-11 10:47:24 +030099 copyartifact \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100100 description-setter \
101 discard-old-build \
102 docker-workflow \
Jakub Josef78b4c442017-04-27 18:46:33 +0200103 email-ext \
Alexander Evseeve5e62012017-08-21 16:34:07 +0300104 envinject \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100105 extended-choice-parameter \
Jakub Josefcf388012017-04-13 15:04:06 +0200106 extensible-choice-parameter \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100107 gerrit-trigger \
Filip Pytlounb0994d92017-03-16 16:12:07 +0100108 git \
Jakub Josef8c1d62a2017-08-10 12:07:20 +0200109 github \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100110 heavy-job \
Kirill Mashchenkob0dce6e2017-10-16 16:19:03 +0300111 jobConfigHistory \
Kirill Mashchenkob69b5ff2017-11-15 12:36:11 +0300112 jira \
Filip Pytlounb30e5fa2017-04-04 16:06:44 +0200113 ldap \
Filip Pytloun4aa3ef82017-06-01 16:54:13 +0200114 lockable-resources \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100115 matrix-auth \
116 monitoring \
Alexander Evseevca4bbbb2017-10-26 15:42:50 +0300117 multiple-scms \
Oleksii Zhurba216b1d72018-04-26 10:06:10 -0500118 performance \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100119 permissive-script-security \
120 pipeline-utility-steps \
Oleksii Zhurba80bec922018-06-13 11:30:42 -0500121 plot \
Konstantin Hontarb6cc0d72017-08-11 10:47:24 +0300122 prometheus \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100123 rebuild \
124 simple-theme-plugin \
125 slack \
Alexander Evseevee38d782017-09-22 16:10:15 +0300126 ssh-agent \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100127 test-stability \
chnyda2dd21382017-09-22 15:29:36 +0200128 throttle-concurrents \
Filip Pytlound903d9a2017-03-16 13:23:05 +0100129 workflow-cps \
130 workflow-remote-loader \
131 workflow-scm-step
azvyagintsev6983fb92018-04-07 16:04:58 +0300132
133# Switch user for cleanup
134USER root
135# Cleanup.
136RUN apt-get -y autoremove; apt-get -y clean;
137RUN rm -rf /root/.cache
138RUN rm -rf /var/lib/apt/lists/*
139RUN rm -rf /tmp/*
140RUN rm -rf /var/tmp/*
141# And switch it back
142USER ${user}