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 | |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 3 | RUN apt-get update && apt-get install -y git curl gettext-base && rm -rf /var/lib/apt/lists/* |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 4 | |
| 5 | ENV JENKINS_HOME /var/jenkins_home |
jeichel | aebb8b2 | 2015-08-10 12:38:20 -0400 | [diff] [blame] | 6 | ENV JENKINS_SLAVE_AGENT_PORT 50000 |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 7 | |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 8 | ARG user=jenkins |
| 9 | ARG group=jenkins |
| 10 | ARG uid=1000 |
| 11 | ARG gid=1000 |
| 12 | |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [diff] [blame] | 13 | # Jenkins is run with user `jenkins`, uid = 1000 |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 14 | # 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] | 15 | # ensure you use the same uid |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 16 | RUN groupadd -g ${gid} ${group} \ |
| 17 | && 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] | 18 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 19 | # Jenkins home directory is a volume, so configuration and build history |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 20 | # can be persisted and survive image upgrades |
| 21 | VOLUME /var/jenkins_home |
| 22 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 23 | # `/usr/share/jenkins/ref/` contains all reference configuration we want |
| 24 | # 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] | 25 | # or config file with your custom jenkins Docker image. |
Filip Pytloun | e9e6f56 | 2016-08-31 16:30:33 +0200 | [diff] [blame] | 26 | 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] | 27 | |
muicoder | bac415c | 2017-01-19 13:47:25 +0800 | [diff] [blame] | 28 | ENV TINI_VERSION 0.13.2 |
| 29 | ENV TINI_SHA afbf8de8a63ce8e4f18cb3f34dfdbbd354af68a1 |
Dionysis Grigoropoulos | b5b788c | 2015-08-12 03:07:53 +0300 | [diff] [blame] | 30 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 31 | # Use tini as subreaper in Docker container to adopt zombie processes |
Thomas Orozco | c0d446e | 2016-12-05 21:11:25 +0100 | [diff] [blame] | 32 | 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] | 33 | && echo "$TINI_SHA /bin/tini" | sha1sum -c - |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 34 | |
Jesse Glick | fc9e710 | 2015-04-28 09:37:28 -0400 | [diff] [blame] | 35 | 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] | 36 | |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 37 | # jenkins version being bundled in this docker image |
Yoanis Gil | 8fbb91f | 2016-03-15 21:45:19 -0400 | [diff] [blame] | 38 | ARG JENKINS_VERSION |
Filip Pytloun | b30e5fa | 2017-04-04 16:06:44 +0200 | [diff] [blame] | 39 | ENV JENKINS_VERSION ${JENKINS_VERSION:-2.52} |
jpthiery | 3eb0f83 | 2015-11-12 13:47:35 +0100 | [diff] [blame] | 40 | |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 41 | # jenkins.war checksum, download will be validated using it |
Filip Pytloun | b30e5fa | 2017-04-04 16:06:44 +0200 | [diff] [blame] | 42 | ARG JENKINS_SHA=7a78fc8b3f1eacd45891d052f7fa03471a60b9df52213b4ee948e05834cffc38 |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 43 | |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 44 | # Can be used to customize where jenkins.war get downloaded from |
Joe Ferguson | d187b53 | 2016-10-17 16:20:16 -0700 | [diff] [blame] | 45 | 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] | 46 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 47 | # 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] | 48 | # see https://github.com/docker/docker/issues/8331 |
Nicolas De loof | 31bc79c | 2016-08-04 14:25:22 +0200 | [diff] [blame] | 49 | RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war \ |
Jon Hermansen | 14d338e | 2017-03-04 07:26:56 -0800 | [diff] [blame] | 50 | && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha256sum -c - |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 51 | |
jamesHsiaoAcquia | aa66561 | 2016-04-21 10:55:00 -0400 | [diff] [blame] | 52 | ENV JENKINS_UC https://updates.jenkins.io |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 53 | RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 54 | |
| 55 | # for main web interface: |
| 56 | EXPOSE 8080 |
| 57 | |
| 58 | # will be used by attached slave agents: |
| 59 | EXPOSE 50000 |
| 60 | |
Carlos Sanchez | c8c95d1 | 2015-07-02 12:36:13 +0200 | [diff] [blame] | 61 | ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log |
Jesse Glick | 8cdfb1f | 2015-04-28 09:32:11 -0400 | [diff] [blame] | 62 | |
Jakub Pavlik | a067c49 | 2016-09-01 15:18:03 +0200 | [diff] [blame] | 63 | COPY SimpleThemeDecorator.xml /tmp/org.codefirst.SimpleThemeDecorator.xml |
| 64 | RUN chown ${user} /tmp/org.codefirst.SimpleThemeDecorator.xml |
| 65 | |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 66 | USER ${user} |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 67 | |
Vincent Latombe | c14af95 | 2016-07-18 10:20:12 +0200 | [diff] [blame] | 68 | COPY jenkins-support /usr/local/bin/jenkins-support |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 69 | COPY jenkins.sh /usr/local/bin/jenkins.sh |
Nicolas De Loof | d5aea67 | 2015-07-15 21:53:48 +0200 | [diff] [blame] | 70 | ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"] |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 71 | |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [diff] [blame] | 72 | # 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] | 73 | COPY plugins.sh /usr/local/bin/plugins.sh |
Nicolas De Loof | dfe81a3 | 2016-05-28 17:26:01 +0200 | [diff] [blame] | 74 | COPY install-plugins.sh /usr/local/bin/install-plugins.sh |
Filip Pytloun | d17c92d | 2017-03-16 17:50:25 +0100 | [diff] [blame] | 75 | COPY theme /usr/share/jenkins/ref/userContent/theme |
Filip Pytloun | 74ce0b0 | 2016-08-31 16:02:16 +0200 | [diff] [blame] | 76 | |
Filip Pytloun | 1e8af36 | 2017-03-16 13:58:44 +0100 | [diff] [blame] | 77 | 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] | 78 | ansicolor \ |
| 79 | artifactory \ |
| 80 | build-blocker-plugin \ |
| 81 | build-monitor-plugin \ |
| 82 | build-user-vars-plugin \ |
| 83 | categorized-view \ |
| 84 | description-setter \ |
| 85 | discard-old-build \ |
| 86 | docker-workflow \ |
Jakub Josef | 78b4c44 | 2017-04-27 18:46:33 +0200 | [diff] [blame] | 87 | email-ext \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 88 | extended-choice-parameter \ |
Jakub Josef | cf38801 | 2017-04-13 15:04:06 +0200 | [diff] [blame] | 89 | extensible-choice-parameter \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 90 | gerrit-trigger \ |
Filip Pytloun | b0994d9 | 2017-03-16 16:12:07 +0100 | [diff] [blame] | 91 | git \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 92 | heavy-job \ |
Kirill Mashchenko | 3a755dc | 2017-10-16 16:19:03 +0300 | [diff] [blame^] | 93 | jobConfigHistory \ |
Filip Pytloun | b30e5fa | 2017-04-04 16:06:44 +0200 | [diff] [blame] | 94 | ldap \ |
Filip Pytloun | 4aa3ef8 | 2017-06-01 16:54:13 +0200 | [diff] [blame] | 95 | lockable-resources \ |
Filip Pytloun | d903d9a | 2017-03-16 13:23:05 +0100 | [diff] [blame] | 96 | matrix-auth \ |
| 97 | monitoring \ |
| 98 | permissive-script-security \ |
| 99 | pipeline-utility-steps \ |
| 100 | rebuild \ |
| 101 | simple-theme-plugin \ |
| 102 | slack \ |
| 103 | test-stability \ |
| 104 | timestamper \ |
| 105 | workflow-cps \ |
| 106 | workflow-remote-loader \ |
| 107 | workflow-scm-step |