Carlos Sanchez | 1956254 | 2015-04-22 11:36:17 -0700 | [diff] [blame] | 1 | FROM java:8u45-jdk |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 2 | |
| 3 | RUN apt-get update && apt-get install -y wget git curl zip && rm -rf /var/lib/apt/lists/* |
| 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 | |
| 8 | # Jenkins is ran with user `jenkins`, uid = 1000 |
Sam Davis | 5437f3f | 2015-08-10 09:34:21 +0100 | [diff] [blame] | 9 | # If you bind mount a volume from host/volume from a data container, |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 10 | # ensure you use same uid |
| 11 | RUN useradd -d "$JENKINS_HOME" -u 1000 -m -s /bin/bash jenkins |
| 12 | |
| 13 | # Jenkins home directoy is a volume, so configuration and build history |
| 14 | # can be persisted and survive image upgrades |
| 15 | VOLUME /var/jenkins_home |
| 16 | |
| 17 | # `/usr/share/jenkins/ref/` contains all reference configuration we want |
| 18 | # to set on a fresh new installation. Use it to bundle additional plugins |
| 19 | # or config file with your custom jenkins Docker image. |
| 20 | RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d |
| 21 | |
Nicolas De Loof | d5aea67 | 2015-07-15 21:53:48 +0200 | [diff] [blame] | 22 | # Use tini as subreaper in Docker container to adopt zombie processes |
| 23 | RUN curl -fL https://github.com/krallin/tini/releases/download/v0.5.0/tini-static -o /bin/tini && chmod +x /bin/tini |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 24 | |
Jesse Glick | fc9e710 | 2015-04-28 09:37:28 -0400 | [diff] [blame] | 25 | 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] | 26 | |
Nicolas De loof | fdeab76 | 2015-07-30 18:18:45 +0200 | [diff] [blame] | 27 | ENV JENKINS_VERSION 1.609.2 |
| 28 | ENV JENKINS_SHA 59215da16f9f8a781d185dde683c05fcf11450ef |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 29 | |
| 30 | # could use ADD but this one does not check Last-Modified header |
| 31 | # see https://github.com/docker/docker/issues/8331 |
Mike Dillon | 1f9d73c | 2015-04-06 17:17:40 -0700 | [diff] [blame] | 32 | RUN curl -fL http://mirrors.jenkins-ci.org/war-stable/$JENKINS_VERSION/jenkins.war -o /usr/share/jenkins/jenkins.war \ |
Kengo TODA | b56f291 | 2015-04-19 11:57:43 +0800 | [diff] [blame] | 33 | && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c - |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 34 | |
| 35 | ENV JENKINS_UC https://updates.jenkins-ci.org |
| 36 | RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref |
| 37 | |
| 38 | # for main web interface: |
| 39 | EXPOSE 8080 |
| 40 | |
| 41 | # will be used by attached slave agents: |
| 42 | EXPOSE 50000 |
| 43 | |
Carlos Sanchez | c8c95d1 | 2015-07-02 12:36:13 +0200 | [diff] [blame] | 44 | ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log |
Jesse Glick | 8cdfb1f | 2015-04-28 09:32:11 -0400 | [diff] [blame] | 45 | |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 46 | USER jenkins |
| 47 | |
| 48 | COPY jenkins.sh /usr/local/bin/jenkins.sh |
Nicolas De Loof | d5aea67 | 2015-07-15 21:53:48 +0200 | [diff] [blame] | 49 | ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"] |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 50 | |
| 51 | # from a derived Dockerfile, can use `RUN plugin.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle |
| 52 | COPY plugins.sh /usr/local/bin/plugins.sh |