Docker is fun ! Thanks Docker team!
Recently I have started working on a new project from scratch. We have containerized all our applications using docker. The project is just kicked off and we are almost done with our dev setup.
Version Control : Tortoise SVN
CI : Jenkins
What I am going to achieve is. using jenkins job I will triggering builds and at the end it will generate shell scripts which build new images and launch the latest containers.
My application has various property files which contains DB string, end point urls , IP address etc. In the traditional approach we have property files for each environment for example local, dev, QA and production. I cannot have this approach when I am using docker because I want to run docker images on any environment without hard-coding anything.
My approach would be:
- Pass all the necessary environment variables into the container when we launch and enable java code to read it from environment variables
- Have a script which will replace property values based on the environment. But this could be nasty when it comes to deployment of war files.
Can one suggest me what would be the best approach in such cases ?