Here are the steps to setup production SGT environment:
- username is your docker username
- image is the name of your docker image
- flag is the flag of your docker image
First, we need to pull the images for postgres and the ruby on rails web server to our machine:
- Login to docker hub:
sudo docker login
- Pull the postgres image:
sudo docker pull liabasb/sgt-postgres
- Pull the rails app image:
sudo docker pull liabasb/sgt
## Running docker images
sudo docker run --name my-postgresql -e POSTGRES_PASSWORD=mypassword -d postgres
sudo docker run -ti --link my-postgresql:postgresql -p 8080:8080 username/image:flag /bin/bash
rake db:create db:migrate db:populate
sudo docker run -ti --link my-postgresql:postgresql -p 8080:8080 username/image:flag
sudo docker run -ti --link my-postgresql:postgresql -p 8080:8080 username/image:flag /bin/bash
rake db:migrate
sudo docker run -ti --link my-postgresql:postgresql -p 8080:8080 username/image:flag
sudo docker run -ti --link my-postgresql:postgresql -p 8080:8080 username/image:flag
sudo docker ps -a
sudo docker inspect username/image:flag
## Development
- Work on the code; update the app...
- Build the docker image from this code:
sudo docker build -t username/image .
(optionnaly set a flag to that image:sudo docker build -t username/image::flag .
) - Check that the image has been created:
sudo docker images
- Check that the new image run properly: see running images
- Push that new image to docker hub:
sudo docker push username/image
- Commit:
sudo docker images