Dockerfile 1.73 KB
Newer Older
1 2
FROM jenkins/inbound-agent:4.3-4-jdk11

Dave's avatar
Dave committed
3 4 5
USER root

# Install maven like in https://github.com/carlossg/docker-maven/tree/master/openjdk-11 .
6
ARG MAVEN_VERSION=3.6.3
Dave's avatar
Dave committed
7
ARG USER_HOME_DIR="/home/jenkins"
8 9 10 11 12 13 14 15 16 17 18 19 20 21
ARG SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
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 \
  && echo "${SHA}  /tmp/apache-maven.tar.gz" | sha512sum -c - \
  && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
  && rm -f /tmp/apache-maven.tar.gz \
  && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY settings-docker.xml /usr/share/maven/ref/
COPY settings-maven.xml ${MAVEN_CONFIG}/settings.xml

Dave's avatar
Dave committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
# 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.

41 42
ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"]

Dave's avatar
Dave committed
43
CMD ["mvn"]