Docker Community Forums

Share and learn in the Docker community.

Beginner questions / Best practices

Hi,

I’m new to Docker but after some reading, I’d like to use it for each one of my projects now, to improve my development / production flow and make it more easy. I am basically deploying application that runs with a Symfony Backend (REST API only), and a ReactJs Frontend. I want the front to be fully separate from the back, so it will be served by another server (container in the case of Docker).

I have successfully configure a local environment, with 4 containers : mysql, php, nginx for Symfony backend, and ReactJs which is launched by the command “npm run start”. It’s working well, but I don’t think it is recommandable to serve React this way in production. Correct me if I’m wrong, but I’ve read that a best way to do it would be to build React (npm run build) and then serve it with a classical server, for example Nginx.

Here come the question : should I have 2 Nginx containers ? One for Symfony, and the other one for React ? Looks a bit overkilled for me, but as for my server knowledge I’m still stuck 10 years ago where you only had to set up Apache =D Or should I set up only one Nginx container, who will served either back and front with something like a reverse proxy ? Maybe there is a third way I didn’t think of ?

Thanks for your advice !

For those who may ask, here are my current development settings : GitHub - jdutheil/docker-symfony-react: Starter App using Symfony as a REST API and ReactJs for Front, served by Docker