From cc018650949452d4fa3e369097af7456a243c5fa Mon Sep 17 00:00:00 2001 From: "M. Scott Ford" Date: Tue, 1 Nov 2022 12:42:05 -0400 Subject: [PATCH] Adds mvn to production container --- Dockerfile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 423e9ae5b..58115becf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,11 +45,29 @@ RUN ./gradlew installDist ### Runtime container # Use Java JRE as the base image -- the `freshli` executable is self contained (meaning it does not need the .NET runtime to be installed) -FROM eclipse-temurin:17-jre-jammy AS final +FROM eclipse-temurin:17-jdk-jammy AS final # Install git RUN apt update -y && apt install git -y +# Install maven +# Copied from https://github.com/carlossg/docker-maven/blob/d2333e08a71fe120a0ac245157906e9b3507cee3/eclipse-temurin-17/Dockerfile +ARG MAVEN_VERSION=3.8.6 +ARG USER_HOME_DIR="/root" +ARG SHA=f790857f3b1f90ae8d16281f902c689e4f136ebe584aba45e4b1fa66c80cba826d3e0e52fdd04ed44b4c66f6d3fe3584a057c26dfcac544a60b301e6d0f91c26 +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" +RUN mkdir -p $MAVEN_CONFIG + # Copy `freshli` executable from the `dotnet_build` image RUN mkdir -p /usr/local/share/freshli COPY --from=dotnet_build /app/freshli/exe/ /usr/local/share/freshli/