Nicolas De loof | 2989f3b | 2015-09-01 08:23:00 +0200 | [diff] [blame] | 1 | FROM java:8-jdk |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 2 | |
Carlos Sanchez | d393aa6 | 2016-04-13 12:14:46 +0200 | [diff] [blame] | 3 | RUN apt-get update && apt-get install -y git curl zip && 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 |
| 14 | # If you bind mount a volume from the host or a data container, |
| 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 | |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [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 | |
| 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 |
| 25 | # or config file with your custom jenkins Docker image. |
| 26 | RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d |
| 27 | |
pli01 | 7c03a37 | 2016-06-15 21:36:58 +0000 | [diff] [blame] | 28 | ENV TINI_VERSION 0.9.0 |
| 29 | ENV TINI_SHA fa23d1e20732501c3bb8eeeca423c89ac80ed452 |
Dionysis Grigoropoulos | b5b788c | 2015-08-12 03:07:53 +0300 | [diff] [blame] | 30 | |
Nicolas De Loof | d5aea67 | 2015-07-15 21:53:48 +0200 | [diff] [blame] | 31 | # Use tini as subreaper in Docker container to adopt zombie processes |
pli01 | 7c03a37 | 2016-06-15 21:36:58 +0000 | [diff] [blame] | 32 | RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static -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 | |
Yoanis Gil | 8fbb91f | 2016-03-15 21:45:19 -0400 | [diff] [blame] | 37 | ARG JENKINS_VERSION |
Carlos Sanchez | 223ca36 | 2016-06-14 15:56:00 +0200 | [diff] [blame] | 38 | ENV JENKINS_VERSION ${JENKINS_VERSION:-1.651.3} |
Yoanis Gil | 8fbb91f | 2016-03-15 21:45:19 -0400 | [diff] [blame] | 39 | ARG JENKINS_SHA |
Carlos Sanchez | 223ca36 | 2016-06-14 15:56:00 +0200 | [diff] [blame] | 40 | ENV JENKINS_SHA ${JENKINS_SHA:-564e49fbd180d077a22a8c7bb5b8d4d58d2a18ce} |
jpthiery | 3eb0f83 | 2015-11-12 13:47:35 +0100 | [diff] [blame] | 41 | |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 42 | |
| 43 | # could use ADD but this one does not check Last-Modified header |
| 44 | # see https://github.com/docker/docker/issues/8331 |
Carlos Sanchez | 67f1189 | 2016-04-04 12:45:27 +0200 | [diff] [blame] | 45 | RUN curl -fsSL http://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war -o /usr/share/jenkins/jenkins.war \ |
Carlos Sanchez | eecaeb2 | 2016-04-13 12:10:39 +0200 | [diff] [blame] | 46 | && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c - |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 47 | |
jamesHsiaoAcquia | aa66561 | 2016-04-21 10:55:00 -0400 | [diff] [blame] | 48 | ENV JENKINS_UC https://updates.jenkins.io |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 49 | RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 50 | |
| 51 | # for main web interface: |
| 52 | EXPOSE 8080 |
| 53 | |
| 54 | # will be used by attached slave agents: |
| 55 | EXPOSE 50000 |
| 56 | |
Carlos Sanchez | c8c95d1 | 2015-07-02 12:36:13 +0200 | [diff] [blame] | 57 | ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log |
Jesse Glick | 8cdfb1f | 2015-04-28 09:32:11 -0400 | [diff] [blame] | 58 | |
Stig Bakken | 854a604 | 2016-03-14 17:04:27 +0100 | [diff] [blame] | 59 | USER ${user} |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 60 | |
| 61 | COPY jenkins.sh /usr/local/bin/jenkins.sh |
Nicolas De Loof | d5aea67 | 2015-07-15 21:53:48 +0200 | [diff] [blame] | 62 | ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"] |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 63 | |
Scott Newson | 39046ee | 2015-10-25 03:16:16 -0600 | [diff] [blame] | 64 | # 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] | 65 | COPY plugins.sh /usr/local/bin/plugins.sh |
Nicolas De Loof | dfe81a3 | 2016-05-28 17:26:01 +0200 | [diff] [blame] | 66 | COPY install-plugins.sh /usr/local/bin/install-plugins.sh |