forked from cuongtransc/docker-image-tmpl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·58 lines (45 loc) · 1.52 KB
/
docker-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
#!/bin/bash
set -e
function gen_config() {
PATH_OFBIZ=/data/coclab-ofbiz
PATH_CONFIG=/data/config
##################### generate config #####################
# List configure files:
# 1. build.xml: config max memory for jvm ofbiz
# 2. entityengine.xml
# 3. url.properties -> use http only
#
# -------------------------------------
# 1. build.xml
# 2. framework/entity/config/entityengine.xml
# 3. framework/webapp/config/url.properties
# port.https.enabled=Y -> N
#
# generate file config
python3 ${PATH_CONFIG}/tmpl/generate_ofbiz_config.py
# config ofbiz
cp ${PATH_CONFIG}/tmpl/build.xml ${PATH_OFBIZ}/build.xml
cp ${PATH_CONFIG}/tmpl/entityengine.xml ${PATH_OFBIZ}/framework/entity/config/entityengine.xml
cp ${PATH_CONFIG}/url.properties ${PATH_OFBIZ}/framework/webapp/config/url.properties
}
# prepare for config default
gen_config
if [ "$1" = 'start-ofbiz' ]; then
##################### handle SIGTERM #####################
function _term() {
printf "%s\n" "Caught terminate signal!"
${PATH_OFBIZ}/ant stop
# kill -SIGTERM $child 2>/dev/null
exit 0
}
trap _term SIGHUP SIGINT SIGTERM SIGQUIT
##################### start application #####################
# start ofbiz
${PATH_OFBIZ}/ant start-batch
# make sure log file existed
touch ${PATH_OFBIZ}/runtime/logs/ofbiz.log
tail -f ${PATH_OFBIZ}/runtime/logs/ofbiz.log &
child=$!
wait "$child"
fi
exec "$@"