forked from surroundaustralia/VocPrez-theme-cgi
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-build.sh
34 lines (28 loc) · 1.1 KB
/
docker-build.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
31
32
33
34
eval $(cat .env | tr -d '\r')
echo "prepare a deployment folder"
mkdir $VP_HOME/deploy
cp -r $VP_HOME/vocprez/* $VP_HOME/deploy
echo "copy CGI style and templates to VocPrez deploy folder"
cp style/* $VP_HOME/deploy/view/style
cp templates/* $VP_HOME/deploy/view/templates
echo "set the VocPrez config"
sed 's#$SPARQL_ENDPOINT#'"$SPARQL_ENDPOINT"'#' $VP_THEME_HOME/config.py > $VP_THEME_HOME/config_updated.py
if [ -z "$SPARQL_USERNAME" ]
then
sed -i 's#$SPARQL_USERNAME#None#' $VP_THEME_HOME/config_updated.py
else
sed -i 's#$SPARQL_USERNAME#'\"$SPARQL_USERNAME\"'#' $VP_THEME_HOME/config_updated.py
fi
if [ -z "$SPARQL_PASSWORD" ]
then
sed -i 's#$SPARQL_PASSWORD#None#' $VP_THEME_HOME/config_updated.py
else
sed -i 's#$SPARQL_PASSWORD#'\"$SPARQL_PASSWORD\"'#' $VP_THEME_HOME/config_updated.py
fi
sed -i 's#$SYSTEM_BASE_URI#'"$SYSTEM_BASE_URI"'#' $VP_THEME_HOME/config_updated.py
mv $VP_THEME_HOME/config_updated.py $VP_HOME/deploy/_config/__init__.py
echo "run Dockerfile there"
docker build -t vocprez-cgi -f $VP_HOME/Dockerfile $VP_HOME
echo "clean-up"
rm -r $VP_HOME/deploy
echo "complete"