This repository has been archived by the owner on Apr 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-build.sh
75 lines (57 loc) · 2.53 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
echo "prepare a deployment folder"
mkdir $VP_HOME/deploy
DEPLOY=$VP_HOME/deploy
cp -r $VP_HOME/vocprez/* $DEPLOY
echo "Copy content"
cp $VP_THEME_HOME/model/* $DEPLOY/model
cp $VP_THEME_HOME/source/* $DEPLOY/source
cp $VP_THEME_HOME/style/* $DEPLOY/view/style
cp $VP_THEME_HOME/templates/* $DEPLOY/view/templates
cp $VP_THEME_HOME/utils.py $DEPLOY/utils.py
cp $VP_THEME_HOME/void.ttl $DEPLOY/view/
echo "Config"
echo "Alter $VP_THEME_HOME/config.py to include variables"
sed 's#$SPARQL_ENDPOINT#'"$SPARQL_ENDPOINT"'#' $VP_THEME_HOME/config.py > $VP_THEME_HOME/config_updated.py
sed -i 's#$ABSOLUTE_URI_BASE#'"$ABSOLUTE_URI_BASE"'#' $VP_THEME_HOME/config_updated.py
sed -i 's#$ABS_URI_BASE_IN_DATA#'"$ABS_URI_BASE_IN_DATA"'#' $VP_THEME_HOME/config_updated.py
sed -i 's#$SYSTEM_BASE_URI#'"$SYSTEM_BASE_URI"'#' $VP_THEME_HOME/config_updated.py
echo "Move $VP_THEME_HOME/config.py to $DEPLOY/_config/__init__.py"
mv $VP_THEME_HOME/config_updated.py $DEPLOY/_config/__init__.py
echo "Routes for app.py"
ORIG=$DEPLOY/app.backup.py
APP=$DEPLOY/app.py
if test -f "$ORIG"; then
echo "Reloading app.py from original"
cp $ORIG $APP
else
echo "Backing up app.py to app.backup.py"
cp $APP $ORIG
fi
echo "\tvocabs"
sed -i -e '/# ROUTE vocabs/!b;:a;N;/# END ROUTE vocabs/M!ba;r app_additions_vocabs.py' -e 'd' $APP
echo "\tvocab"
sed -i -e '/# ROUTE one vocab/!b;:a;N;/# END ROUTE one vocab/M!ba;r app_additions_vocab.py' -e 'd' $APP
echo "\tsearch"
sed -i -e '/# ROUTE search/!b;:a;N;/# END ROUTE search/M!ba;r app_additions_search.py' -e 'd' $APP
echo "\tabout"
sed -i -e '/# ROUTE about/!b;:a;N;/# END ROUTE about/M!ba;r app_additions_about.py' -e 'd' $APP
echo "\tcontact us"
sed -i "/# END ROUTE about/r $VP_THEME_HOME/app_additions_contact_us.py" $APP
echo "\tobject"
sed -i -e '/# ROUTE object/!b;:a;N;/# END ROUTE object/M!ba;r app_additions_object.py' -e 'd' $APP
echo "\tRESTful Concept"
sed -i "/# END ROUTE object/r $VP_THEME_HOME/app_additions_concept.py" $APP
echo "\tmapping"
sed -i "/# END ROUTE cache_reload/r $VP_THEME_HOME/app_additions_mapping.py" $APP
echo "\twell_known"
sed -i "/# END ROUTE mapping/r $VP_THEME_HOME/app_additions_well_known.py" $APP
echo "\tExtra SPARQL endpoint alias"
sed -i 's?# ROUTE sparql?# ROUTE sparql\[email protected]("/sparql/sparql", methods=["GET", "POST"])?' $APP
echo "\tSPARQL training slash"
sed -i 's#"/sparql"#"/sparql/"#' $APP
sed -i 's# VocabularyRenderer# NvsVocabularyRenderer#' $DEPLOY/app.py
echo "run Dockerfile there"
docker build -t vocprez-nvs -f $VP_HOME/Dockerfile $VP_HOME
echo "clean-up"
rm -r $DEPLOY
echo "complete"