ARUNKUMAR SANTHANAM
ARUNKUMAR SANTHANAM

Reputation: 55

How to load the web app folder to docker container

I am new to the docker technology. I have a spring boot application running on my local machine. I need to move the target jar file to the docker container.

This spring boot application is contains rest services and some controller will display the view (JSP) with the help of dispatcher servlet.

While creating the container, I am getting 404 Error for the views returned from the dispatcher servlet. What is the command I need to place in my dockerfile to move my static web app folder to the container ?.

Thanks in advance.

Container is working fine for the rest services. Rest services to perform CRUD with mysql server.

My Dockerfile :

FROM openjdk:8

EXPOSE 7070

ADD target/docker_app.jar docker_app.jar

ENTRYPOINT ["java","-jar","docker_app.jar"]

Upvotes: 2

Views: 1679

Answers (1)

Naresh
Naresh

Reputation: 115

You should not wrap the the web application as jar.

add the following tag in your pom xml

<packaging>war</packaging>

change the Dockerfile command to deploy war file instead of jar.

Dockerfile :

FROM openjdk:8
EXPOSE 7070
ADD target/docker_app.war docker_app.war
ENTRYPOINT ["java","-jar","docker_app.war"]

Upvotes: 1

Related Questions