I am building an app that has a couple of microservices
and trying to prototype a CI/CD
pipeline using Codeship
and Docker
.
I am a bit confused with the difference between using codeship-services.yml
and docker-compose.yml
. Codeship docs say -
By default, we look for the filename codeship-services.yml. In its absence, Codeship will automatically search for a docker-compose.yml file to use in its place.
Per my understanding, docker-compose
could be more appropriate in my case as I'd like to spin up containers for all the microservices
at the same time for integration testing. codeship-services.yml
would have helped if I wanted to build my services serially rather than in parallel.
Is my understanding correct?
You can use the codeship-services.yml
in the same manner as the docker-compose.yml
. So you can define your services and spin up several containers via the link
key.
I do exactly the same in my codeship-services.yml
. I do some testing on my frontend service and that service spins up all depended services (backend, DB, etc.) when I run it via the codeship-steps.yml
, just like in docker-compose.yml
.
At the beginning it was a bit confusing for me to have 2 files which are nearly the same. I actually contacted the Codeship support with that question and the answer was that it could be the same file (because all unavailable features in the compose file are just ignored, see here) but in almost all cases they have seen it was easier to have two separate files at the end, one for CI/CD and one for running docker-compose.
And the same turned out true for me as well, because I need a lot of services which are only for CI/CD like deploying or special test containers which are just doing cURL tests e.g..
I hope that helps and doesn't confuse you more ;)