Last active
July 12, 2021 18:54
-
-
Save CharlesLuxinger/8b9993839a122b6e8ad6a08aa564c25c to your computer and use it in GitHub Desktop.
Multi stage Maven Java 11 Build And Run with NewRelic Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM maven:3.6.3-openjdk-11-slim AS build | |
WORKDIR /build | |
COPY pom.xml . | |
RUN mvn dependency:go-offline | |
COPY src src | |
RUN mvn package -DskipTests --batch-mode --fail-fast | |
RUN apt-get update && \ | |
apt-get install curl unzip -y | |
RUN curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip | |
RUN unzip newrelic-java.zip | |
FROM adoptopenjdk/openjdk11:jre-11.0.9.1_1-alpine AS release | |
WORKDIR /opt/app/ | |
COPY --from=build /build/target/*.jar /app.jar | |
COPY --from=build /build/newrelic/newrelic.jar /newrelic.jar | |
CMD java -javaagent:newrelic.jar \ | |
-Dnewrelic.environment=production \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment