I’m working in ‘dockerizing’ a complex web application into several containers. I have a mongodb database with the oficial mongo image that I want to be able to populate with some fixtures. I have two sets of fixtures, one for development and one for production (this fixture must be loaded in any new deployment). The way I see it, I have two options to implement this.
- Use the base mongo image and using docker-compose figure out a way to run the fixture loading on each container creation.
- Create a new image from the base mongo one and run the fixture loading to create a prepopulated image. Using a flag I could build for dev or prod images.
I can’t figure out which one is the “best” approach or more inline with docker philosfy when building apps. I have the feeling that the first one is better, but I would like more opinions on it and I can’t find any info online about it.
Thanks a lot for any feedback