Tony Mack | 44ad705 | 2015-10-31 18:10:42 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame] | 3 | IMAGE_NAME=xosproject/xos |
| 4 | CONTAINER_NAME=xos_build_helper_$$ |
Tony Mack | 44ad705 | 2015-10-31 18:10:42 +0000 | [diff] [blame] | 5 | DB_HOST=$(wget http://ipinfo.io/ip -qO -) |
| 6 | |
| 7 | # configure db host |
Tony Mack | c1a59d8 | 2015-12-16 17:09:13 +0000 | [diff] [blame] | 8 | docker run -it --name=$CONTAINER_NAME $IMAGE_NAME sed -i '0,/host/{s/host=localhost/host='$DB_HOST'/}' /opt/xos/xos_configuration/xos_common_config |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame] | 9 | docker commit $CONTAINER_NAME $IMAGE_NAME |
| 10 | docker rm $CONTAINER_NAME |
Tony Mack | 44ad705 | 2015-10-31 18:10:42 +0000 | [diff] [blame] | 11 | |
| 12 | # init db schema |
Scott Baker | 0e1a056 | 2016-01-14 09:38:34 -0800 | [diff] [blame] | 13 | docker run -it --name=$CONTAINER_NAME $IMAGE_NAME /opt/xos/tools/xos-manage makemigrations |
Tony Mack | 502bb59 | 2015-11-01 16:28:54 +0000 | [diff] [blame] | 14 | # run overrides the CMD specifed in the Dockerfile, so we re-set the CMD in the final commit" |
Tony Mack | 12963cf | 2015-12-16 17:40:00 +0000 | [diff] [blame] | 15 | docker commit --change="CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure" $CONTAINER_NAME $IMAGE_NAME |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame] | 16 | docker rm $CONTAINER_NAME |