blob: f142acf4d1d20848420b2a151bc78336d051392d [file] [log] [blame]
Carlos Sanchez19562542015-04-22 11:36:17 -07001FROM java:8u45-jdk
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +01002
3RUN apt-get update && apt-get install -y wget git curl zip && rm -rf /var/lib/apt/lists/*
4
5ENV JENKINS_HOME /var/jenkins_home
jeichelaebb8b22015-08-10 12:38:20 -04006ENV JENKINS_SLAVE_AGENT_PORT 50000
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +01007
8# Jenkins is ran with user `jenkins`, uid = 1000
Sam Davis5437f3f2015-08-10 09:34:21 +01009# If you bind mount a volume from host/volume from a data container,
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010010# ensure you use same uid
11RUN 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
15VOLUME /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.
20RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d
21
Nicolas De Loofd5aea672015-07-15 21:53:48 +020022# Use tini as subreaper in Docker container to adopt zombie processes
23RUN curl -fL https://github.com/krallin/tini/releases/download/v0.5.0/tini-static -o /bin/tini && chmod +x /bin/tini
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010024
Jesse Glickfc9e7102015-04-28 09:37:28 -040025COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010026
Nicolas De looffdeab762015-07-30 18:18:45 +020027ENV JENKINS_VERSION 1.609.2
28ENV JENKINS_SHA 59215da16f9f8a781d185dde683c05fcf11450ef
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010029
30# could use ADD but this one does not check Last-Modified header
31# see https://github.com/docker/docker/issues/8331
Mike Dillon1f9d73c2015-04-06 17:17:40 -070032RUN curl -fL http://mirrors.jenkins-ci.org/war-stable/$JENKINS_VERSION/jenkins.war -o /usr/share/jenkins/jenkins.war \
Kengo TODAb56f2912015-04-19 11:57:43 +080033 && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010034
35ENV JENKINS_UC https://updates.jenkins-ci.org
36RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref
37
38# for main web interface:
39EXPOSE 8080
40
41# will be used by attached slave agents:
42EXPOSE 50000
43
Carlos Sanchezc8c95d12015-07-02 12:36:13 +020044ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
Jesse Glick8cdfb1f2015-04-28 09:32:11 -040045
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010046USER jenkins
47
48COPY jenkins.sh /usr/local/bin/jenkins.sh
Nicolas De Loofd5aea672015-07-15 21:53:48 +020049ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010050
51# from a derived Dockerfile, can use `RUN plugin.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
52COPY plugins.sh /usr/local/bin/plugins.sh