You can use this project as template for deploying any dockerized application in a server without much pain. Just need to replace sample projects (frontend, backend, third-party) relevant way.
As the sample code,
Frontend --> Backend(calculate function) --> ThirdParty(response decorate function)
And also, update the docker images names in the docker-compose.yaml file as necessary.
|
|- frontend-app -> React
| |
| |- development env - PORT 3000 (host machine)
| |- production env - PORT 80 (docker container)
|
|- backend-app -> Express.js
| |
| |- development env - PORT 3001 (host machine)
| |- production env - PORT 80 (docker container)
|
|- third-party-app -> Express.js
| |
| |- development env - PORT 3002 (host machine)
| |- production env - PORT 80 (docker container)
|
|- reverse-proxy -> Docker/Nginx
|
|- production env - PORT 80 (docker container)
|
|- frontend-app -> PORT 80 (host machine) "localhost"
|- backend-app -> PORT 80 (host machine) "localhost/api/"
- clone the project
- run
npm installfor backend-app, third-part-app and front-end application - run
npm startin frontend-app (PORT 3000) - run
npm start-nodemonin backend-app (PORT 3001) - run
npm start-nodemonin third-party-app (PORT 3002)
- run
docker-compose buildfrom root folder - run
docker-compose up -dfor starting containers (PORT 80 / localhost) - run
docker-compose downfor stopping containers