A R Karthick | e3bde96 | 2016-09-27 15:06:35 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | IMAGE_NAME=xosproject/xos |
| 4 | CONTAINER_NAME=xos_build_helper_$$ |
| 5 | DB_HOST=$(wget http://ipinfo.io/ip -qO -) |
| 6 | |
| 7 | # configure db host |
| 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 |
| 9 | docker commit $CONTAINER_NAME $IMAGE_NAME |
| 10 | docker rm $CONTAINER_NAME |
| 11 | |
| 12 | # init db schema |
| 13 | docker run -it --name=$CONTAINER_NAME $IMAGE_NAME /opt/xos/tools/xos-manage makemigrations |
| 14 | # run overrides the CMD specifed in the Dockerfile, so we re-set the CMD in the final commit" |
| 15 | docker commit --change="CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure" $CONTAINER_NAME $IMAGE_NAME |
| 16 | docker rm $CONTAINER_NAME |