/
entrypoint.sh
executable file
路36 lines (31 loc) 路 1.13 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
#!/usr/bin/env bash
set -e
if [[ ! -z "$@" ]] ; then
BOOT_MODE=TASK
else
BOOT_MODE=SERVICE
fi
for f in /usr/local/boot/*.sh ; do
BOOT_MODE=${BOOT_MODE} . "$f"
done
# We use option "-c" here to suppress following warning message from console output:
# UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations...
if [[ -n "$(ls /etc/supervisor/conf.d/*.conf 2>/dev/null)" ]] ; then
if [[ "SERVICE" == "${BOOT_MODE}" ]] ; then
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf -n
else
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
fi
fi
if [[ ! -z "$@" ]] ; then
if [[ "${1}" =~ ^(ba|)sh$ ]] ; then
# To support Docker commands like following:
# docker run --rm swoole/swoole:4.3.5 bash -c "composer --version"
# docker run --rm swoole/swoole:4.3.5 sh -c "composer --version"
exec "$@"
else
# To support Docker commands invoked in ECS (via command "aws ecs run-task"), kind of like following:
# docker run --rm swoole/swoole:4.3.5 "composer --version"
exec $@
fi
fi