forked from plone/volto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·70 lines (54 loc) · 1.73 KB
/
entrypoint.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
#!/usr/bin/env bash
set -Ex
REBUILD=""
if [ -z "$API_PATH" ]; then
API_PATH="http://localhost:8080/Plone"
fi
if [ -z "$INTERNAL_API_PATH" ]; then
INTERNAL_API_PATH="http://plone:8080/Plone"
fi
function apply_volto {
yo --force --no-insight @plone/volto --volto=$VOLTO --no-interactive --skip-install
REBUILD="$REBUILD $VOLTO"
}
function apply_addons {
install=""
for addon in $ADDONS; do
install="$install --addon $addon"
done
if [ -z "$VOLTO" ]; then
VOLTO=$(jq -r '.dependencies["@plone/volto"]' package.json)
fi
yo --force --no-insight @plone/volto --volto=$VOLTO --no-interactive --skip-install $install
REBUILD="$REBUILD $ADDONS"
}
function apply_rebuild {
RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn
RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build
}
function apply_path {
mainjs=./build/server.js
bundlejs=./build/public/static/js/*.js
test -f $mainjs
echo "Check that we have API_PATH and API vars"
test -n "$API_PATH"
echo "Changing built files inplace"
sed -i "s#VOLTO_API_PATH#${API_PATH}#g" $mainjs
sed -i "s#VOLTO_API_PATH#${API_PATH}#g" $bundlejs
sed -i "s#VOLTO_INTERNAL_API_PATH#${INTERNAL_API_PATH}#g" $mainjs
sed -i "s#VOLTO_INTERNAL_API_PATH#${INTERNAL_API_PATH}#g" $bundlejs
echo "Zipping JS Files"
gzip -fk $mainjs
}
# Should we install other version of Volto?
test -n "$VOLTO" && apply_volto
# Should we install any Volto add-on?
test -n "$ADDONS" && apply_addons
# Should we re-build
test -n "$REBUILD" && apply_rebuild
# Should we monkey patch?
test -n "$API_PATH" && apply_path
# Sentry
./create-sentry-release.sh
echo "Starting Volto"
exec "$@"