I need some help and be pointed in the correct direction.

I have 6 git repositories that together combine a bigger application (3 Node.js API, 2 React web apps and one repository for Ansible and templates for config files for the other repos).

Currently we are building it only with Ansible and CircleCI but the current build process is not that great and I think of moving to Docker, docker-compose and CircleCI 2.0.

The thing is: how should I dockerize it?

All the databases are remote. How should I approach nginx?

I thought about writing Dockerfiles for each application and then using Ansible to connect to host, install Docker, pull sources and start building containers from Dockerfiles.

Nginx should be configured by Ansible on host or can it be made into a Docker container somehow?

1 Answer 1


With docker compose (or docker swarm if you want to distribute the containers) create a container for each Git repository. This should map well to docker’s philosophy of each container being used for a single purpose.

As far as examples go, I can recommend you have a look at veleda (shameless self-promotion) which combines 3 databases, a flask app, a ruby app (Grafana), Jekyll and nginx. It also includes unit tests that are integrated into Travis-ci and should be transferable to circle-ci.

Regarding the nginx aspect, 030 already mentioned that there are finished images to make your life easier. Even ones that include automated Let’s Encrypt services.

Ansible can be integrated well into the mix. If you used it to install dependencies and network configurations, this is now handled by docker. For SSH-based tasks, ansible remains useful. Check out this comparison of tools and their scope’s of responsibility.

  • So I would have CircleCI setup to run Ansible playbook that would SSH into a target server, install Docker and docker-compose, pull git repositories and run docker-compose?
    – user134865
    Feb 18, 2018 at 13:48
  • And don’t forget secret management. Not sure how we’ll circle ci supports it, but it’s quite easy on Travis. Here are two good guides: gist.github.com/nickbclifford/16c5be884c8a15dca02dca09f65f97bd and kjaer.io/travis
    – Moritz
    Feb 18, 2018 at 16:46
  • I handle secrets via ansible-vault and CircleCI's environment variables.
    – user134865
    Feb 19, 2018 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.