Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 1 | FROM java:openjdk-7u65-jdk |
| 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 |
| 6 | |
| 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 |
| 10 | RUN useradd -d "$JENKINS_HOME" -u 1000 -m -s /bin/bash jenkins |
| 11 | |
| 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 | |
Jesse Glick | fc9e710 | 2015-04-28 09:37:28 -0400 | [diff] [blame^] | 22 | 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] | 23 | |
Nicolas De loof | 66dc639 | 2015-04-07 06:54:13 +0200 | [diff] [blame] | 24 | ENV JENKINS_VERSION 1.596.2 |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 25 | |
| 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 | 66dc639 | 2015-04-07 06:54:13 +0200 | [diff] [blame] | 28 | RUN curl -L http://mirrors.jenkins-ci.org/war-stable/$JENKINS_VERSION/jenkins.war -o /usr/share/jenkins/jenkins.war |
Nicolas De Loof | b75dc1a | 2015-03-17 11:24:05 +0100 | [diff] [blame] | 29 | |
| 30 | ENV JENKINS_UC https://updates.jenkins-ci.org |
| 31 | RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref |
| 32 | |
| 33 | # for main web interface: |
| 34 | EXPOSE 8080 |
| 35 | |
| 36 | # will be used by attached slave agents: |
| 37 | EXPOSE 50000 |
| 38 | |
| 39 | USER jenkins |
| 40 | |
| 41 | COPY jenkins.sh /usr/local/bin/jenkins.sh |
| 42 | ENTRYPOINT ["/usr/local/bin/jenkins.sh"] |
| 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 |