blob: 64d1fe345dd805c351c099f53271b7ab4aa98b11 [file] [log] [blame]
Nicolas De loof2989f3b2015-09-01 08:23:00 +02001FROM java:8-jdk
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +01002
Niklaus Giger995f6812015-09-08 12:01:45 +02003RUN apt-get update && apt-get install -y wget git curl zip file && rm -rf /var/lib/apt/lists/*
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +01004
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
Dionysis Grigoropoulosb5b788c2015-08-12 03:07:53 +030022ENV TINI_SHA 066ad710107dc7ee05d3aa6e4974f01dc98f3888
23
Nicolas De Loofd5aea672015-07-15 21:53:48 +020024# Use tini as subreaper in Docker container to adopt zombie processes
Dionysis Grigoropoulosb5b788c2015-08-12 03:07:53 +030025RUN curl -fL https://github.com/krallin/tini/releases/download/v0.5.0/tini-static -o /bin/tini && chmod +x /bin/tini \
26 && echo "$TINI_SHA /bin/tini" | sha1sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010027
Jesse Glickfc9e7102015-04-28 09:37:28 -040028COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010029
Nicolas De loof9395d3f2015-09-03 21:58:37 +020030ENV JENKINS_VERSION 1.609.3
Nicolas De looffef08f72015-09-03 21:38:03 +020031ENV JENKINS_SHA f5ad5f749c759da7e1a18b96be5db974f126b71e
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010032
33# could use ADD but this one does not check Last-Modified header
34# see https://github.com/docker/docker/issues/8331
Mike Dillon1f9d73c2015-04-06 17:17:40 -070035RUN 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 +080036 && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010037
38ENV JENKINS_UC https://updates.jenkins-ci.org
39RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref
40
41# for main web interface:
42EXPOSE 8080
43
44# will be used by attached slave agents:
45EXPOSE 50000
46
Carlos Sanchezc8c95d12015-07-02 12:36:13 +020047ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
Jesse Glick8cdfb1f2015-04-28 09:32:11 -040048
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010049USER jenkins
50
51COPY jenkins.sh /usr/local/bin/jenkins.sh
Nicolas De Loofd5aea672015-07-15 21:53:48 +020052ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010053
54# from a derived Dockerfile, can use `RUN plugin.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
55COPY plugins.sh /usr/local/bin/plugins.sh