-
Notifications
You must be signed in to change notification settings - Fork 1
/
entrypoint-prod.sh
executable file
·50 lines (37 loc) · 1.18 KB
/
entrypoint-prod.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
#!/usr/bin/env bash
set -Ex
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 monkey patch?
test -n "$API_PATH" && apply_path
if [ -z "$TIMEOUT" ]; then
TIMEOUT="120000"
fi
if [ -z "$RAZZLE_API_PATH" ]; then
RAZZLE_API_PATH="http://plone:8080/energy"
fi
if [ -z "$CYPRESS_API_PATH" ]; then
CYPRESS_API_PATH="$RAZZLE_API_PATH"
fi
if [[ "$1" == "cypress"* ]]; then
echo "Starting cypress testing"
RAZZLE_API_PATH=$RAZZLE_API_PATH yarn start &
cd /opt/frontend
exec bash -c "wait-on -t $TIMEOUT http://localhost:3000 && NODE_ENV=production CYPRESS_API_PATH=$CYPRESS_API_PATH ./node_modules/cypress/bin/cypress run"
exit 0
fi
./create-sentry-release.sh
echo "Starting Volto"
exec "$@"