I'm asking myself the same question: Where to put my docker-compose.yml
file?
I've decided to do it the following way:
- One Repo for the
docker-compose.yml
along with deployment scripts (Jenkins pipeline in my case).
- One Repo per micro service along with a Dockerfile and its build logic (built image is pushed to private docker registry).
Why?
- The
docker-compose.yml
describes a system (the composition of micro services) and how it is deployed.
- A micro services should be independent from the system infrastructure.
- There could be more than one system (different composition of the micro services) with a second
docker-compose.yml
(and Repo).
However, of course there are reasonable exceptions.
Assume you're deploying a customized Database along with a management tool (e.g. customized mariadb and adminer), then most things may live in one repository.
project/app-mysql/
and there you could save yourdocker-compose.yaml
(which includes the setup of your app + mysql). That's how we use it. – Yelmeneapp-mysql/
(and one for each app-xxx) or just one git repo for all projects inproject/
? – Jilljillana