-
Notifications
You must be signed in to change notification settings - Fork 23
/
docker-entrypoint.sh
executable file
·42 lines (35 loc) · 1.05 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
#!/bin/bash
certfile=$(ls /rems/certs 2>/dev/null)
parameters=false
cmd_prefix=""
cmd=""
full_cmd=""
declare -a cmd_array
if [ ! -z ${certfile} ] && [ "${certfile}" != "null" ] ; then
keytool -importcert -cacerts -noprompt \
-storepass changeit \
-file /rems/certs/${certfile} \
-alias ${certfile}
keytool -storepasswd -cacerts \
-storepass changeit \
-new $(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 20)
fi
if [ "${CMD}" ] ; then
IFS=';' read -r -a cmd_array <<< "${CMD}"
elif [ "${COMMANDS}" ] ; then
IFS=' ' read -r -a cmd_array <<< "${COMMANDS}"
else
cmd_array=("run")
fi
for cmd in "${cmd_array[@]}"
do
[ "${cmd}" = "run" ] && cmd_prefix="exec"
FULL_COMMAND="${cmd_prefix} java -Drems.config=config/config.edn -jar rems.jar ${cmd}"
echo "####################"
echo "########## RUNNING COMMAND: ${FULL_COMMAND}"
echo "####################"
${FULL_COMMAND}
done
echo "####################"
echo "########## CONTAINER STARTUP FINISHED"
echo "####################"