Commit 9afac5f6 authored by Dave's avatar Dave

Add docker instalation.

parent 980a4373
FROM jenkins/inbound-agent:4.3-4-jdk11 FROM jenkins/inbound-agent:4.3-4-jdk11
# install maven like https://github.com/carlossg/docker-maven/tree/master/openjdk-11 USER root
# Install maven like in https://github.com/carlossg/docker-maven/tree/master/openjdk-11 .
ARG MAVEN_VERSION=3.6.3 ARG MAVEN_VERSION=3.6.3
ARG USER_HOME_DIR="/root" ARG USER_HOME_DIR="/home/jenkins"
ARG SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0 ARG SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \ && echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \ && rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY settings-docker.xml /usr/share/maven/ref/ COPY settings-docker.xml /usr/share/maven/ref/
# configure maven
COPY settings-maven.xml ${MAVEN_CONFIG}/settings.xml COPY settings-maven.xml ${MAVEN_CONFIG}/settings.xml
# Install Docker like in https://medium.com/@manav503/how-to-build-docker-images-inside-a-jenkins-container-d59944102f30 .
RUN apt-get update -qq \
&& apt-get install -qqy apt-transport-https ca-certificates curl gnupg2 software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
RUN apt-get update -qq \
&& apt-get install docker-ce=18.06.3~ce~3-0~debian -y
RUN usermod -aG docker jenkins
# Configure Maven.
RUN chown -R jenkins:jenkins ${MAVEN_CONFIG}
USER jenkins
# Configure Docker.
# Nothing to do.
ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]
CMD ["mvn"] CMD ["mvn"]
\ No newline at end of file
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment