I am beginning the process of moving my django stack to docker containers. Most examples I have seen put the
docker-compose.yml files in the same repository as the application source code.
I have been using ansible for deployment so far, it's served me well, and I intend to keep it while gradually packaging the various services into containers. All my ansible files are in their own git repository, separate from the app source code, so all my config is versioned. This has worked very well so far.
My question is about location of
docker files. I have put them with the app code, but I now feel that this is forcing me to put deployment-related info in the app code, which I feel is wrong.
An example: I use Celery for various processes, which relies on rabbitmq for messaging. Each one lives in a container as seems to be recommended. I need to pass Celery the password for rabbitmq, which I'm passing as an environment variable in
docker-compose.yml. So in short, my deployment password is in the app code. This is only one of several examples.
What is the best practice to split up app code VS deployment config and scripts in this context? Or more specifically, where should the docker files live?