Skip to content

Instantly share code, notes, and snippets.

@webdevwilson
Created September 20, 2022 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdevwilson/bbef75ec2fe1c082692d72daf49b940c to your computer and use it in GitHub Desktop.
Save webdevwilson/bbef75ec2fe1c082692d72daf49b940c to your computer and use it in GitHub Desktop.
# build the application with maven jdk-17
FROM public.ecr.aws/docker/library/maven:3-amazoncorretto-17 AS build
WORKDIR /project
ADD pom.xml /project
RUN mvn verify --fail-never
COPY . .
RUN mvn package
# Add the jar to the final docker image
FROM public.ecr.aws/amazoncorretto/amazoncorretto:17
COPY --from=build /project/target/app.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment