Using docker-compose to Containerise Traccar Backend and the Modern React.js Frontend

Traccar is an awesome open source GPS tracking platform. The backend is written in Java, a modern frontend (web app) that was recently developed in React.js has been implemented, it might replace the classic interface in the future. The frontend isn’t fully complete at the date of the publication of the current article, but it’s very interesting taking into consideration the advantages offered by React.js.

I decided to not use any specific IDE as the documentation suggests to build the dependencies and run the project. Rather, while it’s possible with docker why not taking advantage of docker-compose to run the frontend and the backend in dev or production mode with a single line.

Here the structure of the project

The Server Dockerfile

The Frontend (React App) Dockerfile

The Dockerfile is placed in /frontend folder that contains both old and /modern web app interfaces. The source code of our React.js app is inside /modern folder.


Run the platform’s containers with docker-compose

Now run the containers with –build to build the images first before running using:

docker-compose up --build

Hope it helps.

Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

Open chat
Powered by