@@ -13,12 +13,21 @@ RUN apt-get install -y openjdk-8-jdk
1313# ------------ Tools f Jenkins and apt-get to use SSL Repositorys
1414RUN apt-get install -y --no-install-recommends apt-utils git wget curl graphviz \
1515 apt-transport-https ca-certificates software-properties-common
16+ # -----------------------------------------------
17+ # --------------- Ansible
18+ # -----------------------------------------------
19+ RUN apt-add-repository ppa:ansible/ansible 2>/dev/null
20+ RUN apt-get update && apt-get -y install ansible
21+ # --------------------------------------------
1622# ------------ Docker
23+ # --------------------------------------------
1724RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg > docker-public-key && apt-key add docker-public-key && rm docker-public-key
1825RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
1926RUN apt-get update && apt-get install -y docker-ce
27+ # --------------------------------------------
2028# ------------ Docker Compose
21- RUN curl -o /usr/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)" \
29+ # --------------------------------------------
30+ RUN curl -o /usr/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.16.1/docker-compose-$(uname -s)-$(uname -m)" \
2231 && chmod +x /usr/bin/docker-compose
2332
2433ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
@@ -30,8 +39,7 @@ ENV GIT_SSL_NO_VERIFY=1
3039# -----------------------------------------------
3140# install Oracle Java if you want ... and
3241# remove the line "RUN apt-get install -y openjdk-8-jdk"
33- # and uncomment the next lines
34- # above ... but openjdk is pretty good !
42+ # and uncomment the next lines above ... but openjdk is pretty good !
3543# -----------------------------------------------
3644# ------------ Download
3745# ## ENV filename jdk-8u131-linux-x64.tar.gz
@@ -63,9 +71,7 @@ ARG user=jenkins
6371ARG group=jenkins
6472ARG uid=1000
6573ARG gid=1000
66- # Jenkins is run with user `jenkins`, uid = 1000
67- # If you bind mount a volume from the host or a data container,
68- # ensure you use the same uid
74+ # Jenkins is run with user `jenkins`, uid = 1000 If you bind mount a volume from the host or a data container, ensure you use the same uid
6975RUN groupadd -g ${gid} ${group} && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}
7076# Jenkins home directory is a volume, so configuration and build history
7177# can be persisted and survive image upgrades
@@ -85,24 +91,34 @@ RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION
8591COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
8692
8793# jenkins version being bundled in this docker image
94+ # This is the latest stable version
8895ARG JENKINS_VERSION
89- ENV JENKINS_VERSION ${JENKINS_VERSION:-2.79 }
96+ ENV JENKINS_VERSION ${JENKINS_VERSION:-2.73.2 }
9097
91- # jenkins.war checksum, download will be validated using it
92- ARG JENKINS_SHA=272e035475837b5e1c4efb84c8b65949e3f658a3
98+ # ### jenkins.war checksum, download will be validated using it
99+ ARG JENKINS_SHA=1489e498f682e8b61ce4cf8124de200f264b087c
93100
94- # Can be used to customize where jenkins.war get downloaded from http://updates.jenkins-ci.org/download/war/2.79/jenkins.war
95101ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
96102
97103# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum
98104# see https://github.com/docker/docker/issues/8331
99105RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c -
100106
107+ # ------------------ Optional lokal caching of files
108+ # Download jenkins with yout favorite browser and put the war in the current dir.
109+ # COPY jenkins-war-2.73.2.war /usr/share/jenkins/jenkins.war
110+ # ##### # Copy all Cached plugins ...
111+ # to preLoad all Plugins listed in active-plugins.txt use the command
112+ # ./preDownload.sh $(cat active-plugins.txt)
113+ # this will download all the plugins in th Folder Plugins
114+ # COPY Plugins/* /usr/share/jenkins/ref/plugins/
115+ # ------------------ Optional lokal caching of files end block
101116
102117ENV JENKINS_UC https://updates.jenkins.io
118+ ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
103119RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref
104120
105- # for main web interface:
121+ # for main web interface, reversed-proxied by nginx
106122EXPOSE 8080
107123
108124ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
@@ -115,24 +131,25 @@ COPY jenkins.sh /usr/local/bin/jenkins.sh
115131ENV JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.requestfield=crumb"
116132
117133ENTRYPOINT ["/bin/tini" , "--" , "/usr/local/bin/jenkins.sh" ]
118- # -----------------------------------------------
119- # get all Plugins from existing Jenins
120- # -----------------------------------------------
134+ # -------------------------------------------------------------------------
135+ # get all Plugins from existing Jenins without Version (latest is used)
136+ # --------------------------------------------------------------------------
121137# JENKINS_HOST=username:password@myhost.com:port
122- # curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/'
138+ # curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | \
139+ # perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/ ' | awk -F: '{ print $1 }' | sort'
140+ # ----------------------------------------------------
123141
142+ # from a derived Dockerfile, can use `RUN /usr/local/bin/install-plugins.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
124143
125- # ----------------------------------------------------
126144COPY plugins.sh /usr/local/bin/plugins.sh
127145COPY install-plugins.sh /usr/local/bin/install-plugins.sh
128- # Install additional plugins
129- COPY plugins.txt /usr/share/jenkins/ref/
130- RUN /usr/local/bin/plugins.sh /usr/share/jenkins/ref/plugins.txt
131-
132- USER root
146+ COPY active-plugins.txt /active-plugins.txt
133147
134- RUN apt-get clean
148+ RUN /usr/local/bin/plugins.sh active-plugins.txt
135149
150+ # install-plugins.sh get in trouble with curl maybe better next time in Jenkins ---> RUN /usr/local/bin/install-plugins.sh $(cat active-plugins.txt)
136151
152+ USER root
137153
154+ RUN apt-get clean && rm -rf /var/lib/apt/lists/*
138155
0 commit comments