[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"]





Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why I jumped at JavaScript/NodeJS hype train and then bounce back

Building an extensible Dynamic Pluggable Enterprise Application with Angular

Create Responsive React app using react-responsive

How to Create a Neat Pop-Up Animation with Remotion

The React Native Adventure

Build Linkedoff using React Native, Redux, and Backendless — Part 3: Backendless Setup

Ten Topics That I learned Toady

Growing Star Sports club:-

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



More from Medium

Send Compressed Data From Spring Boot , Uncompress & read in ReactJS

Spring Boot Integration with MongoDB

AWS EC2 with Java SDK — Part 2

Validating MongoDB Documents in Spring Boot

A MongoDB collection with a basic JSON schema