Skip to content

Commit fe83049

Browse files
author
Tom
committed
Update to latest Jenkins, Docker and Maven in fat-jenkins Image
1 parent 1cacb50 commit fe83049

File tree

2 files changed

+48
-27
lines changed

2 files changed

+48
-27
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ For example: If yuo configure a GitLab-Connection in Jenkins, you will reach Git
148148
* ssh cloning and pushing is at port 2222 (ssh://git@myHOST:2222/scott/foo.git remeber to upload your public key before, should be ~/.ssh/id_rsa.pub )
149149

150150
#### gitlab-runner
151-
The runner is a gitlab-multirunner image with a docker-runner (concurrent=1) , based on [gitlab/gitlab-runner][2] at every startup any runner is removed and only ONE new runner is registrated to avoid multiple runners (the pipeline-history maybe lost.) docker-in-docker works :-)
151+
The runner is a gitlab-multirunner image with a docker-runner (concurrent=1) , based on [gitlab/gitlab-runner][2] at every startup any runner is removed and only ONE new runner
152+
is registrated to avoid multiple runners (the pipeline-history maybe lost.)
153+
setups with a shell-runner works, docker-in-docker (docker:dind) or docker based builds should cause trouble because the
154+
default DNS-Server of a docker-container ist 8.8.8.8 (google) see this link [extra_host for servce][5] for a possible workaround
152155

153156
It takes a long time until gitlab is ready to accept a runner registration, if it fails, increase the REGISTER_TRYS in docker-compse.yml
154157

@@ -165,7 +168,7 @@ There is a testproject in folder spring-boot-keycloak-sample, it is a standard S
165168
```
166169
mv spring-boot:run
167170
```
168-
Use your browser and navigate to the "landing-page" at http://<your host>:8081 the "My products" link will redirect you to Keycloak (must be setup with settings from [this tutorial][3], but use your *REAL* hostname, not _localhost_ as Valid Redirect URI's )
171+
Use your browser and navigate to the "landing-page" at http://your-host:8081 the "My products" link will redirect you to Keycloak (must be setup with settings from [this tutorial][3], but use your *REAL* hostname, not _localhost_ as Valid Redirect URI's )
169172

170173
_tl;dr_
171174
* login as user:admin, password:admin
@@ -258,3 +261,4 @@ docker network rm dockerlocalbuildenvironment_default dockerlocalbuildenvironmen
258261
[2]: https://hub.docker.com/r/gitlab/gitlab-runner/
259262
[3]: https://developers.redhat.com/blog/2017/05/25/easily-secure-your-spring-boot-applications-with-keycloak/
260263
[4]: https://xebialabs.com/periodic-table-of-devops-tools/
264+
[5]: https://gitlab.com/gitlab-org/gitlab-runner/issues/2302

jenkins-fat/Dockerfile

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:17.10
1+
FROM ubuntu:18.04
22
ENV DEBIAN_FRONTEND noninteractive
33
ENV JAVA_VERSION=8 \
44
JAVA_UPDATE=131 \
@@ -7,32 +7,42 @@ ENV JAVA_VERSION=8 \
77

88
# update dpkg repositories and install tools
99
RUN apt-get update
10+
#--------------------------------------------
1011
#------------ Open JDK
1112
RUN apt-get install -y openjdk-8-jdk
12-
#------------ Tools f Jenkins and apt-get to use SSL Repositorys
13+
#--------------------------------------------
14+
#------------ Tools for Jenkins and apt-get to use SSL Repositorys
1315
RUN apt-get install -y --no-install-recommends apt-utils git wget curl graphviz \
14-
apt-transport-https ca-certificates software-properties-common
15-
#-----------------------------------------------
16+
apt-transport-https ca-certificates software-properties-common gpg-agent zip unzip
17+
#-----------------------------------------------
1618
#--------------- Ansible
1719
#-----------------------------------------------
1820
RUN apt-add-repository ppa:ansible/ansible 2>/dev/null
1921
RUN apt-get update && apt-get -y install ansible
2022
#--------------------------------------------
2123
#------------ Docker
2224
#--------------------------------------------
23-
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg > docker-public-key && apt-key add docker-public-key && rm docker-public-key
24-
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
25-
RUN apt-get update && apt-get install -y docker-ce
25+
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg > docker-public-key && \
26+
apt-key add docker-public-key && \
27+
rm docker-public-key
28+
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" && \
29+
apt-get update && apt-get install -y docker-ce
2630
#--------------------------------------------
2731
#------------ Docker Compose
2832
#--------------------------------------------
29-
RUN curl -o /usr/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.18.0/docker-compose-$(uname -s)-$(uname -m)" \
33+
RUN curl -o /usr/bin/docker-compose -L \
34+
"https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m)" \
3035
&& chmod +x /usr/bin/docker-compose
3136

37+
#--------------------------------------------
38+
#------------ Jenkins with jdk-8
39+
#--------------------------------------------
40+
3241
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
3342

3443
# This is the line for the Jenkins prefix to set ... remember
35-
# to set the location in the reverse-proxy.conf
44+
# to set the location in the reverse-proxy.conf if you change this
45+
3646
ENV JENKINS_OPTS="--webroot=/var/cache/jenkins/war --prefix=/jenkins"
3747
ENV GIT_SSL_NO_VERIFY=1
3848
#-----------------------------------------------
@@ -51,16 +61,20 @@ ENV GIT_SSL_NO_VERIFY=1
5161
#----------------------------------------
5262
# install Maven
5363
#----------------------------------------
54-
# get maven 3.5.2
55-
RUN wget --no-verbose -O /tmp/apache-maven-3.5.2.tar.gz http://archive.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
56-
# verify checksum
57-
RUN echo "948110de4aab290033c23bf4894f7d9a /tmp/apache-maven-3.5.2.tar.gz" | md5sum -c
58-
# install maven
59-
RUN tar xzf /tmp/apache-maven-3.5.2.tar.gz -C /opt/ && ln -s /opt/apache-maven-3.5.2 /opt/maven
64+
RUN wget --no-verbose -O /tmp/apache-maven-3.5.3.tar.gz \
65+
http://archive.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
66+
# verify checksum and install maven
67+
RUN echo "51025855d5a7456fc1a67666fbef29de /tmp/apache-maven-3.5.3.tar.gz" | md5sum -c && \
68+
tar xzf /tmp/apache-maven-3.5.3.tar.gz -C /opt/ && ln -s /opt/apache-maven-3.5.3 /opt/maven
69+
6070
ENV MAVEN_HOME /opt/maven
6171
ENV PATH $MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
6272

63-
RUN apt-get update && apt-get install -y zip unzip && rm -rf /opt/java/src.zip && rm -rf /tmp/$filename && rm -f /tmp/apache-maven-3.5.2.tar.gz
73+
RUN rm -rf /opt/java/src.zip && \
74+
rm -rf /tmp/$filename && \
75+
rm -f /tmp/apache-maven-3.5.3.tar.gz
76+
77+
6478
#------------------------------
6579
# install Jenkins
6680
#------------------------------
@@ -81,8 +95,8 @@ VOLUME /var/jenkins_home
8195
# to set on a fresh new installation. Use it to bundle additional plugins
8296
# or config file with your custom jenkins Docker image.
8397
RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d && mkdir /tmp
84-
ENV TINI_VERSION 0.14.0
85-
ENV TINI_SHA 6c41ec7d33e857d4779f14d9c74924cab0c7973485d2972419a3b7c7620ff5fd
98+
ENV TINI_VERSION 0.18.0
99+
ENV TINI_SHA eadb9d6e2dc960655481d78a92d2c8bc021861045987ccd3e27c7eae5af0cf33
86100
# Use tini as subreaper in Docker container to adopt zombie processes
87101
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini \
88102
&& echo "$TINI_SHA /bin/tini" | sha256sum -c -
@@ -92,20 +106,22 @@ COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groov
92106
# jenkins version being bundled in this docker image
93107
# This is the latest stable version
94108
ARG JENKINS_VERSION
95-
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.89.3}
109+
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.125}
96110

97111
#### jenkins.war checksum, download will be validated using it
98112
ARG JENKINS_SHA=80d9a44198195f70218867086759c108821ca0ce
99-
100-
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
113+
ARG JENKINS_URL=http://updates.jenkins-ci.org/download/war/${JENKINS_VERSION}/jenkins.war
101114

102115
# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum
103116
# see https://github.com/docker/docker/issues/8331
104-
RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c -
117+
# RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c -
118+
119+
RUN wget --no-verbose ${JENKINS_URL} -O /usr/share/jenkins/jenkins.war && \
120+
echo "422ba2120ade4c39e19c1aa63684c5db /usr/share/jenkins/jenkins.war" | md5sum -c
105121

106122
#------------------ Optional local caching of files
107123
# Download jenkins with yout favorite browser and put the war in the current dir.
108-
# COPY jenkins-war-2.89.2.war /usr/share/jenkins/jenkins.war
124+
# COPY jenkins-war-${JENKINS_VERSION:-2.99}.war /usr/share/jenkins/jenkins.war
109125
###### # Copy all Cached plugins ...
110126
# to preLoad all Plugins listed in active-plugins.txt use the command
111127
# ./preDownload.sh $(cat active-plugins.txt)
@@ -131,7 +147,8 @@ ENV JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.requestfield=c
131147

132148
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
133149
#-------------------------------------------------------------------------
134-
# get all Plugins from existing Jenins without Version (latest is used)
150+
# if you need a list of all your actual plugins use this to
151+
# get all Plugins from an existing Jenins without Version (latest is used)
135152
#--------------------------------------------------------------------------
136153
# JENKINS_HOST=username:password@myhost.com:port
137154
# curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | \
@@ -150,4 +167,4 @@ RUN /usr/local/bin/plugins.sh active-plugins.txt
150167

151168
USER root
152169

153-
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
170+
RUN apt-get clean autoremove && rm -rf /var/lib/apt/lists/*

0 commit comments

Comments
 (0)