[Docker] Multi-stage Docker Build for React and Spring Boot

React using NPM and Nginx

Note that yarn can be used instead of npm. Feel free to use whichever works for your environment.

Because my React application makes requests to the Spring Boot backend, nginx.conf was added to set up a reverse proxy.

Spring Boot using Maven

Note that Java Options can added in CMD.

For example, when I set up an acceptance environment where Product Managers can test to accept or reject stories, I used this as CMD instead:

CMD ["java", "-Dspring.profiles.active=docker", "-jar", "app.jar"]



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store