blob: 6a23b3584e7499dce72849b43e099f7df66cace9 [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
21
Jesse Glickfc9e7102015-04-28 09:37:28 -040022COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010023
Nicolas De loof66dc6392015-04-07 06:54:13 +020024ENV JENKINS_VERSION 1.596.2
Kengo TODAb56f2912015-04-19 11:57:43 +080025ENV JENKINS_SHA 96ee85602a41d68c164fb54d4796be5d1d9cc5d0
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010026
27# could use ADD but this one does not check Last-Modified header
28# see https://github.com/docker/docker/issues/8331
Kengo TODAb56f2912015-04-19 11:57:43 +080029RUN curl -L http://mirrors.jenkins-ci.org/war-stable/$JENKINS_VERSION/jenkins.war -o /usr/share/jenkins/jenkins.war \
30 && echo "$JENKINS_SHA /usr/share/jenkins/jenkins.war" | sha1sum -c -
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010031
32ENV JENKINS_UC https://updates.jenkins-ci.org
33RUN chown -R jenkins "$JENKINS_HOME" /usr/share/jenkins/ref
34
35# for main web interface:
36EXPOSE 8080
37
38# will be used by attached slave agents:
39EXPOSE 50000
40
Jesse Glick8cdfb1f2015-04-28 09:32:11 -040041ENV COPY_REFERENCE_FILE_LOG /var/log/copy_reference_file.log
42RUN touch $COPY_REFERENCE_FILE_LOG && chown jenkins.jenkins $COPY_REFERENCE_FILE_LOG
43
Nicolas De Loofb75dc1a2015-03-17 11:24:05 +010044USER jenkins
45
46COPY jenkins.sh /usr/local/bin/jenkins.sh
47ENTRYPOINT ["/usr/local/bin/jenkins.sh"]
48
49# from a derived Dockerfile, can use `RUN plugin.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
50COPY plugins.sh /usr/local/bin/plugins.sh