forked from nansencenter/django-geo-spaas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_container.sh
executable file
·30 lines (23 loc) · 947 Bytes
/
build_container.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# build image for running geospaas (with Python Nansat, Django, Geo-SpaaS)
docker build . -t geospaas
# set project name
PROJECT_NAME=project
# if project does not exist
if [ ! -d "$PROJECT_NAME" ]; then
# create project in the current directory
docker run --rm -v `pwd`:/src geospaas django-admin startproject $PROJECT_NAME
# copy default settings
cp tests/*.py $PROJECT_NAME/$PROJECT_NAME/
sed -i -e 's/tests/project/g' $PROJECT_NAME/$PROJECT_NAME/settings.py
# migrate data to database
docker run --rm -v `pwd`:/src geospaas $PROJECT_NAME/manage.py migrate
# add metadata to Vocabularies
docker run --rm -v `pwd`:/src geospaas $PROJECT_NAME/manage.py update_vocabularies
fi
# remove container geospaaas (if it exists)
docker rm geospaas 2> /dev/null
# build container geospaas (mount the current directory and geospass)
docker create -it --name=geospaas \
-v `pwd`:/src \
geospaas