blob: dab5eaa032e33fb27c5656593a0d160bd1565687 [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
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
10RUN 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
14VOLUME /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.
19RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d
20
Nicolas De Loofd5aea672015-07-15 21:53:48 +020021# Use tini as subreaper in Docker container to adopt zombie processes
22RUN 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 +010023
Jesse Glickfc9e7102015-04-28 09:37:28 -040024COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010025
Nicolas De looffdeab762015-07-30 18:18:45 +020026ENV JENKINS_VERSION 1.609.2
27ENV JENKINS_SHA 59215da16f9f8a781d185dde683c05fcf11450ef
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010028
29# could use ADD but this one does not check Last-Modified header
30# see https://github.com/docker/docker/issues/8331
Mike Dillon1f9d73c2015-04-06 17:17:40 -070031RUN 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 +080032 && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010033
34ENV JENKINS_UC https://updates.jenkins-ci.org
35RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref
36
37# for main web interface:
38EXPOSE 8080
39
40# will be used by attached slave agents:
41EXPOSE 50000
42
Carlos Sanchezc8c95d12015-07-02 12:36:13 +020043ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
Jesse Glick8cdfb1f2015-04-28 09:32:11 -040044
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010045USER jenkins
46
47COPY jenkins.sh /usr/local/bin/jenkins.sh
Nicolas De Loofd5aea672015-07-15 21:53:48 +020048ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010049
50# from a derived Dockerfile, can use `RUN plugin.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
51COPY plugins.sh /usr/local/bin/plugins.sh