blob: 41e0a9af0b3808210f98bd38d8a1eb5dc1305efe [file] [log] [blame]
Tony Macka0340632015-10-31 18:10:42 +00001#!/bin/bash
2
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -08003IMAGE_NAME=xosproject/xos
4CONTAINER_NAME=xos_build_helper_$$
Tony Macka0340632015-10-31 18:10:42 +00005DB_HOST=$(wget http://ipinfo.io/ip -qO -)
6
7# configure db host
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -08008docker run -it --name=$CONTAINER_NAME $IMAGE_NAME sed -i '0,/host/{s/host=localhost/host='$DB_HOST'/}' /opt/xos/xos_config
9docker commit $CONTAINER_NAME $IMAGE_NAME
10docker rm $CONTAINER_NAME
Tony Macka0340632015-10-31 18:10:42 +000011
12# init db schema
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080013docker run -it --name=$CONTAINER_NAME $IMAGE_NAME /opt/xos/scripts/opencloud makemigrations
Tony Mackdaa25a62015-11-01 16:28:54 +000014# run overrides the CMD specifed in the Dockerfile, so we re-set the CMD in the final commit"
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080015echo docker commit --change="CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure" $CONTAINER_NAME $IMAGE_NAME
16docker commit --change="CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure" $CONTAINER_NAME $IMAGE_NAME
17docker rm $CONTAINER_NAME