Carlos Sanchez | 64c7ca3 | 2016-08-15 13:36:55 +0200 | [diff] [blame] | 1 | FROM openjdk:8-jdk |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 2 | |
azvyagintsev | 6983fb9 | 2018-04-07 16:04:58 +0300 | [diff] [blame^] | 3 | LABEL maintainer="dev@mirantis.com" |
| 4 | |
| 5 | ENV DEBIAN_FRONTEND=noninteractive \ |
| 6 | DEBCONF_NONINTERACTIVE_SEEN=true \ |
| 7 | LANG=C.UTF-8 \ |
| 8 | LANGUAGE=$LANG |
| 9 | SHELL ["/bin/bash", "-xec"] |
| 10 | |
| 11 | # Base apt config |
| 12 | RUN 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 | |
| 17 | RUN apt-get update && apt-get install -y git curl gettext-base python-virtualenv |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 18 | |
| 19 | ENV JENKINS_HOME /var/jenkins_home |
jeichel | aebb8b2 | 2015-08-10 12:38:20 -0400 | [diff] [blame] | 20 | ENV JENKINS_SLAVE_AGENT_PORT 50000 |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 21 | |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 22 | ARG user=jenkins |
| 23 | ARG group=jenkins |
| 24 | ARG uid=1000 |
| 25 | ARG gid=1000 |
| 26 | |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [diff] [blame] | 27 | # Jenkins is run with user `jenkins`, uid = 1000 |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 28 | # If you bind mount a volume from the host or a data container, |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [diff] [blame] | 29 | # ensure you use the same uid |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 30 | RUN groupadd -g ${gid} ${group} \ |
| 31 | && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user} |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 32 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 33 | # Jenkins home directory is a volume, so configuration and build history |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 34 | # can be persisted and survive image upgrades |
| 35 | VOLUME /var/jenkins_home |
| 36 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 37 | # `/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 Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 39 | # or config file with your custom jenkins Docker image. |
Filip Pytloun | e9e6f56 | 2016-08-31 16:30:33 +0200 | [diff] [blame] | 40 | RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d; chown ${uid}:${gid} /usr/share/jenkins/ref/init.groovy.d |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 41 | |
muicoder | bac415c | 2017-01-19 13:47:25 +0800 | [diff] [blame] | 42 | ENV TINI_VERSION 0.13.2 |
| 43 | ENV TINI_SHA afbf8de8a63ce8e4f18cb3f34dfdbbd354af68a1 |
Dionysis Grigoropoulos | b5b788c | 2015-08-12 03:07:53 +0300 | [diff] [blame] | 44 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 45 | # Use tini as subreaper in Docker container to adopt zombie processes |
Thomas Orozco | c0d446e | 2016-12-05 21:11:25 +0100 | [diff] [blame] | 46 | RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini \ |
Carlos Sanchez | eecaeb2 | 2016-04-13 12:10:39 +0200 | [diff] [blame] | 47 | && echo "$TINI_SHA /bin/tini" | sha1sum -c - |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 48 | |
Jesse Glick | fc9e710 | 2015-04-28 09:37:28 -0400 | [diff] [blame] | 49 | COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 50 | |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 51 | # jenkins version being bundled in this docker image |
Yoanis Gil | 8fbb91f | 2016-03-15 21:45:19 -0400 | [diff] [blame] | 52 | ARG JENKINS_VERSION |
Jakub Josef | 415054f | 2018-01-31 15:21:38 +0100 | [diff] [blame] | 53 | ENV JENKINS_VERSION ${JENKINS_VERSION:-2.104} |
jpthiery | 3eb0f83 | 2015-11-12 13:47:35 +0100 | [diff] [blame] | 54 | |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 55 | # jenkins.war checksum, download will be validated using it |
Jakub Josef | 415054f | 2018-01-31 15:21:38 +0100 | [diff] [blame] | 56 | ARG JENKINS_SHA=51724ecb3c287d13679d9c1bde72552283928b17f49861fe2bfd337fbbfb95a0 |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 57 | |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 58 | # Can be used to customize where jenkins.war get downloaded from |
Joe Ferguson | d187b53 | 2016-10-17 16:20:16 -0700 | [diff] [blame] | 59 | ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 60 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 61 | # could use ADD but this one does not check Last-Modified header neither does it allow to control checksum |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 62 | # see https://github.com/docker/docker/issues/8331 |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 63 | RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war \ |
Jon Hermansen | 14d338e | 2017-03-04 07:26:56 -0800 | [diff] [blame] | 64 | && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha256sum -c - |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 65 | |
jamesHsiaoAcquia | aa66561 | 2016-04-21 10:55:00 -0400 | [diff] [blame] | 66 | ENV JENKINS_UC https://updates.jenkins.io |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 67 | RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 68 | |
| 69 | # for main web interface: |
| 70 | EXPOSE 8080 |
| 71 | |
| 72 | # will be used by attached slave agents: |
| 73 | EXPOSE 50000 |
| 74 | |
Carlos Sanchez | c8c95d1 | 2015-07-02 12:36:13 +0200 | [diff] [blame] | 75 | ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log |
Jesse Glick | 8cdfb1f | 2015-04-28 09:32:11 -0400 | [diff] [blame] | 76 | |
Jakub Pavlik | a067c49 | 2016-09-01 15:18:03 +0200 | [diff] [blame] | 77 | COPY SimpleThemeDecorator.xml /tmp/org.codefirst.SimpleThemeDecorator.xml |
| 78 | RUN chown ${user} /tmp/org.codefirst.SimpleThemeDecorator.xml |
| 79 | |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 80 | USER ${user} |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 81 | |
Vincent Latombe | c14af95 | 2016-07-18 10:20:12 +0200 | [diff] [blame] | 82 | COPY jenkins-support /usr/local/bin/jenkins-support |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 83 | COPY jenkins.sh /usr/local/bin/jenkins.sh |
Nicolas De Loof | d5aea67 | 2015-07-15 21:53:48 +0200 | [diff] [blame] | 84 | ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"] |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 85 | |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [diff] [blame] | 86 | # from a derived Dockerfile, can use `RUN plugins.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 87 | COPY plugins.sh /usr/local/bin/plugins.sh |
Nicolas De Loof | dfe81a3 | 2016-05-28 17:26:01 +0200 | [diff] [blame] | 88 | COPY install-plugins.sh /usr/local/bin/install-plugins.sh |
Filip Pytloun | d17c92d | 2017-03-16 17:50:25 +0100 | [diff] [blame] | 89 | COPY theme /usr/share/jenkins/ref/userContent/theme |
Filip Pytloun | 74ce0b0 | 2016-08-31 16:02:16 +0200 | [diff] [blame] | 90 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 91 | RUN JENKINS_UC_DOWNLOAD=http://archives.jenkins-ci.org /usr/local/bin/install-plugins.sh \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 92 | artifactory \ |
Jakub Josef | 8ba23df | 2018-01-05 15:31:14 +0100 | [diff] [blame] | 93 | blueocean \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 94 | build-blocker-plugin \ |
| 95 | build-monitor-plugin \ |
Alexander Evseev | d5dbc52 | 2017-11-08 18:40:41 +0300 | [diff] [blame] | 96 | build-timeout \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 97 | build-user-vars-plugin \ |
| 98 | categorized-view \ |
Konstantin Hontar | b6cc0d7 | 2017-08-11 10:47:24 +0300 | [diff] [blame] | 99 | copyartifact \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 100 | description-setter \ |
| 101 | discard-old-build \ |
| 102 | docker-workflow \ |
Jakub Josef | 78b4c44 | 2017-04-27 18:46:33 +0200 | [diff] [blame] | 103 | email-ext \ |
Alexander Evseev | e5e6201 | 2017-08-21 16:34:07 +0300 | [diff] [blame] | 104 | envinject \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 105 | extended-choice-parameter \ |
Jakub Josef | cf38801 | 2017-04-13 15:04:06 +0200 | [diff] [blame] | 106 | extensible-choice-parameter \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 107 | gerrit-trigger \ |
Filip Pytloun | b0994d9 | 2017-03-16 16:12:07 +0100 | [diff] [blame] | 108 | git \ |
Jakub Josef | 8c1d62a | 2017-08-10 12:07:20 +0200 | [diff] [blame] | 109 | github \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 110 | heavy-job \ |
Kirill Mashchenko | b0dce6e | 2017-10-16 16:19:03 +0300 | [diff] [blame] | 111 | jobConfigHistory \ |
Kirill Mashchenko | b69b5ff | 2017-11-15 12:36:11 +0300 | [diff] [blame] | 112 | jira \ |
Filip Pytloun | b30e5fa | 2017-04-04 16:06:44 +0200 | [diff] [blame] | 113 | ldap \ |
Filip Pytloun | 4aa3ef8 | 2017-06-01 16:54:13 +0200 | [diff] [blame] | 114 | lockable-resources \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 115 | matrix-auth \ |
| 116 | monitoring \ |
Alexander Evseev | ca4bbbb | 2017-10-26 15:42:50 +0300 | [diff] [blame] | 117 | multiple-scms \ |
Oleksii Zhurba | 216b1d7 | 2018-04-26 10:06:10 -0500 | [diff] [blame] | 118 | performance \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 119 | permissive-script-security \ |
| 120 | pipeline-utility-steps \ |
Oleksii Zhurba | 80bec92 | 2018-06-13 11:30:42 -0500 | [diff] [blame] | 121 | plot \ |
Konstantin Hontar | b6cc0d7 | 2017-08-11 10:47:24 +0300 | [diff] [blame] | 122 | prometheus \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 123 | rebuild \ |
| 124 | simple-theme-plugin \ |
| 125 | slack \ |
Alexander Evseev | ee38d78 | 2017-09-22 16:10:15 +0300 | [diff] [blame] | 126 | ssh-agent \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 127 | test-stability \ |
chnyda | 2dd2138 | 2017-09-22 15:29:36 +0200 | [diff] [blame] | 128 | throttle-concurrents \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 129 | workflow-cps \ |
| 130 | workflow-remote-loader \ |
| 131 | workflow-scm-step |
azvyagintsev | 6983fb9 | 2018-04-07 16:04:58 +0300 | [diff] [blame^] | 132 | |
| 133 | # Switch user for cleanup |
| 134 | USER root |
| 135 | # Cleanup. |
| 136 | RUN apt-get -y autoremove; apt-get -y clean; |
| 137 | RUN rm -rf /root/.cache |
| 138 | RUN rm -rf /var/lib/apt/lists/* |
| 139 | RUN rm -rf /tmp/* |
| 140 | RUN rm -rf /var/tmp/* |
| 141 | # And switch it back |
| 142 | USER ${user} |