-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·61 lines (52 loc) · 1.43 KB
/
entrypoint.sh
File metadata and controls
executable file
·61 lines (52 loc) · 1.43 KB
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
#!/bin/bash
set -e
if [ "$1" == "supervisord" ]; then
# Visible provisioning
bash /opt/docker/bin/provision.sh entrypoint
else
# Hidden provisioning
bash /opt/docker/bin/provision.sh entrypoint > /dev/null
fi
#############################
## COMMAND
#############################
case "$1" in
## Supervisord (start daemons)
supervisord)
## Register IP
ETH0_IP=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
mkdir -p /data/dns/
chmod 777 /data/dns/
echo "${ETH0_IP}" > /data/dns/main.ip
echo "${ETH0_IP} main main_1" > /data/dns/main.hosts
## Start services
cd /
exec supervisord -c /opt/docker/conf/supervisord.conf --logfile /dev/null --pidfile /dev/null --user root
;;
## Root shell
root)
if [ "$#" -eq 1 ]; then
## No command, fall back to shell
exec bash
else
## Exec root command
shift
exec "$@"
fi
;;
## Defined cli script
cli)
if [ -n "${CLI_SCRIPT}" ]; then
shift
exec sudo -H -E -u "${CLI_USER}" ${CLI_SCRIPT} "$@"
else
echo "[ERROR] No CLI_SCRIPT in docker-env.yml defined"
exit 1
fi
;;
## All other commands
*)
## Execute cmd
exec sudo -H -E -u "${CLI_USER}" "$@"
;;
esac