'best way to add a spring boot web application with JSPs to a docker container?

so i have a spring boot web application, it uses JSPs, and im supposed to put it in a container .
my question is what is the best way ? ive tried to copy the project and then run it there using a wmvn like so : dockerfile:

FROM openjdk:8-jdk-alpine
ADD . /input-webapp
WORKDIR /input-webapp
EXPOSE 8080:8080
ENTRYPOINT ./mvnw spring-boot:run

which works, but it takes a long time getting the dependencies and feels messy .

and ive tried to package it into a jar, and then copy the jar only, and run it : dockerfile:

FROM openjdk:8-jdk-alpine
ADD target/input-webapp-0.0.1-SNAPSHOT.jar input-webapp-0.0.1-SNAPSHOT.jar
EXPOSE 8080:8080
ENTRYPOINT ["java","-jar","input-webapp-0.0.1-SNAPSHOT.jar"]

but this way it cant see the JSPs, or at least i think this is the problem, as i get a 404.

so is there a better way ? can i copy the jsps plus the jar to make it work? thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source