I have a sample django app that I am trying to get up and running using docker.
docker-compose up brings up the web, db and other containers along with links between them. But there are pre and post scripts that might need to be run..
example of pre-scripts in my scenario:
git
pip
docker
docker-compose
wget
example of post-scripts :
Database migrations, usually done manually using docker run web... after the containers are up and running.
Currently I have a deploy.sh at the root of app which follows logic like this..(I choose a ubuntu image when launching)
#assuming I always choose ubuntu base image
sudo apt-get install x
sudo apt-get install y
sudo apt-get install z
docker-compose build .; docker-compose up -d;
docker-compose run web "python manage.py makemigrations"
My questions:
1) what is the best way to run these commands?
2) Are database migrations run each time you deploy (from scratch?) - or is this issue taken care of by volumes?