This repository is part of the blog post, which have some tips about automation of any project start and testing using docker-compose.
Repository consist 4 independent services:
- Landing - a landing site
- Web - a simple frontend that serves client side assets for React application and do some server side rendering.
- Api - a restful api.
- Admin - an admin site
Note: all services are just fake and you can skip reading everything except: Dockerfile, Dockerfile.dev, package.json within every project. docker-compose.yml, docker-compose.local-tests.yml & .env file.
To start entire application run simple command in terminal: ./bin/start.sh
To test application run ./bin/run-tests.sh
.
Dockerfile.dev used to run every project on local environment. There are two reasons for using separate dockerfile for local environments:
- To run application using Nodemon, which automatically restart application on code change. (same can be achieved by overriding
command
in docker-compose.yml) - Production Docker files has
npm run build && npm prune --production
. That needed to keep your Docker images smaller, by removing devDependencies afterbuild
step has been completed. In this step you would typically use Webpack, Gulp or any other bundlers / task runners.
If image size is not an issue - I would recommend to keep same Dockerfile for both development and production environments.
Feedback are welcome using issues!