-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathentrypoint.sh
50 lines (38 loc) · 1.08 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Docker entrypoint for the shakecast server
APP_SERVER=${APP_SERVER:-true}
USER_ID=${SHAKECAST_USER_ID:-0}
python3 -m shakecast.app.startup
# Run any arguments directly
if [ $# -gt 0 ];
then
exec "$@"
exit 0;
elif [ "${USER_ID}" -gt 0 ];
then
# Running shakecast as a local user
echo "Starting with UID : $USER_ID";
id -u shakecast &>/dev/null || useradd -u $USER_ID -o shakecast;
chown -R shakecast:shakecast .;
if [ "${APP_SERVER}" = "true" ];
then
exec /usr/local/bin/gosu shakecast python3 -m shakecast.app.server start;
else
exec /usr/local/bin/gosu shakecast python3 -m shakecast.api;
fi
exit 0;
fi
# Running shakecast as the root user
echo "
**************************************************************************
Starting as Root, recommend setting SHAKECAST_USER_ID to a local user id
Example:
export SHAKECAST_USER_ID=\${UID}
**************************************************************************
";
if [ "${APP_SERVER}" = "true" ];
then
exec python3 -m shakecast.app.server start;
else
exec python3 -m shakecast.api;
fi