How to run a Spring Boot application previously deployed on an application server in docker on AWS?

452 Views Asked by At

I have a Spring Boot application that needs to be deployed as a docker container on AWS. In our old production environment we packaged the application as a WAR file and deployed it to an application server. How can we package the application with the application server so that it can run as a docker container?

1

There are 1 best solutions below

0
Johan Nordlinder On BEST ANSWER

Each Spring Boot web application includes an embedded web server. Just run the JAR in the docker container and your application will spin-up, there is no need for a separate application server.

Dockerfile can be as simple as:

FROM openjdk:8-jdk-alpine
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

Don't forget to use the Spring Boot Maven Plugin to make the JAR executable.