Pingping Lin | b7a7d2b | 2016-08-19 18:11:36 +0000 | [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 update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure" $CONTAINER_NAME $IMAGE_NAME |
| 16 | docker rm $CONTAINER_NAME |