Last active
April 16, 2023 16:08
-
-
Save gesielrosa/1b24d8512054003143a240c84e707413 to your computer and use it in GitHub Desktop.
Dockerfile to build Java/Maven application and run on a Tomcat webservice
This file contains 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
ARG APP_NAME=aplication-name | |
FROM maven:3.6.1-jdk-8-alpine as build-env | |
COPY pom.xml /tmp/ | |
COPY src /tmp/src/ | |
WORKDIR /tmp/ | |
RUN mvn package | |
FROM tomcat:10.1.7-jdk11 as prod-env | |
ARG APP_NAME | |
COPY --from=build-env /tmp/target/${APP_NAME}.war $CATALINA_HOME/webapps/${APP_NAME}.war | |
EXPOSE 8009 | |
EXPOSE 8080 | |
CMD ["catalina.sh", "run"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment