Skip to content

Commit

Permalink
Adds mvn to production container (#387)
Browse files Browse the repository at this point in the history
This also required switching from a JRE base image to a JDK base image.
  • Loading branch information
mscottford authored Nov 1, 2022
2 parents fb1a3e2 + cc01865 commit cd4ee39
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit cd4ee39

Please sign in to comment.