Nicolas De loof | 11e9eb7 | 2014-10-09 11:14:00 +0200 | [diff] [blame] | 1 | FROM java:openjdk-7u65-jdk |
Michael Neale | 2627b96 | 2014-07-21 15:52:23 +1000 | [diff] [blame] | 2 | |
Tianon Gravi | c9c889b | 2014-09-29 11:37:09 -0600 | [diff] [blame] | 3 | RUN apt-get update && apt-get install -y wget git curl zip && rm -rf /var/lib/apt/lists/* |
Michael Neale | 2627b96 | 2014-07-21 15:52:23 +1000 | [diff] [blame] | 4 | |
Nicolas De Loof | 79dc46d | 2014-11-28 10:16:36 +0100 | [diff] [blame] | 5 | ENV JENKINS_HOME /var/jenkins_home |
Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 6 | |
Nicolas De Loof | 3d78499 | 2014-11-28 10:15:15 +0100 | [diff] [blame] | 7 | # Jenkins is ran with user `jenkins`, uid = 1000 |
| 8 | # If you bind mount a volume from host/vloume from a data container, |
| 9 | # ensure you use same uid |
Nicolas De Loof | 79dc46d | 2014-11-28 10:16:36 +0100 | [diff] [blame] | 10 | RUN useradd -d "$JENKINS_HOME" -u 1000 -m -s /bin/bash jenkins |
Carlos Sanchez | c223beb | 2014-10-02 11:06:30 +0200 | [diff] [blame] | 11 | |
Nicolas De Loof | 9a36662 | 2014-11-28 10:19:40 +0100 | [diff] [blame] | 12 | # Jenkins home directoy is a volume, so configuration and build history |
| 13 | # can be persisted and survive image upgrades |
| 14 | VOLUME /var/jenkins_home |
| 15 | |
| 16 | # `/usr/share/jenkins/ref/` contains all reference configuration we want |
| 17 | # to set on a fresh new installation. Use it to bundle additional plugins |
| 18 | # or config file with your custom jenkins Docker image. |
| 19 | RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d |
| 20 | |
| 21 | |
Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 22 | COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-angent-port.groovy |
| 23 | |
Nicolas De Loof | 5882631 | 2014-11-28 10:52:05 +0100 | [diff] [blame] | 24 | ENV JENKINS_VERSION %%JENKINS_VERSION%% |
Nicolas De Loof | 572587c | 2014-11-28 10:20:11 +0100 | [diff] [blame] | 25 | |
Nicolas De Loof | 9a36662 | 2014-11-28 10:19:40 +0100 | [diff] [blame] | 26 | # could use ADD but this one does not check Last-Modified header |
| 27 | # see https://github.com/docker/docker/issues/8331 |
Nicolas De Loof | 40c3e3f | 2014-12-02 17:19:06 +0100 | [diff] [blame] | 28 | RUN curl -L %%DOWNLOAD_URL%% -o /usr/share/jenkins/jenkins.war |
Tianon Gravi | c9c889b | 2014-09-29 11:37:09 -0600 | [diff] [blame] | 29 | |
Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 30 | ENV JENKINS_UC https://updates.jenkins-ci.org |
Nicolas De Loof | 79dc46d | 2014-11-28 10:16:36 +0100 | [diff] [blame] | 31 | RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref |
Tianon Gravi | c9c889b | 2014-09-29 11:37:09 -0600 | [diff] [blame] | 32 | |
Michael Neale | 3e124ed | 2014-07-18 15:12:27 +1000 | [diff] [blame] | 33 | # for main web interface: |
Michael Neale | fe68374 | 2014-09-26 20:49:30 +1000 | [diff] [blame] | 34 | EXPOSE 8080 |
Michael Neale | 3e124ed | 2014-07-18 15:12:27 +1000 | [diff] [blame] | 35 | |
| 36 | # will be used by attached slave agents: |
Michael Neale | fe68374 | 2014-09-26 20:49:30 +1000 | [diff] [blame] | 37 | EXPOSE 50000 |
Michael Neale | 2627b96 | 2014-07-21 15:52:23 +1000 | [diff] [blame] | 38 | |
Tianon Gravi | c9c889b | 2014-09-29 11:37:09 -0600 | [diff] [blame] | 39 | USER jenkins |
Nicolas De Loof | 28d0c59 | 2014-10-01 15:07:26 +0200 | [diff] [blame] | 40 | |
Nicolas De Loof | d606438 | 2014-10-04 08:17:28 +0200 | [diff] [blame] | 41 | COPY jenkins.sh /usr/local/bin/jenkins.sh |
| 42 | ENTRYPOINT ["/usr/local/bin/jenkins.sh"] |
Nicolas De Loof | acb8649 | 2014-10-24 13:43:13 +0200 | [diff] [blame] | 43 | |
| 44 | # from a derived Dockerfile, can use `RUN plugin.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle |
| 45 | COPY plugins.sh /usr/local/bin/plugins.sh |