-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·31 lines (25 loc) · 900 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·31 lines (25 loc) · 900 Bytes
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
#!/bin/bash
set -e
#remove any stale socket file so that restarts do not fail
rm -f "${OVERMIND_SOCKET}"
# If GOSU_CHOWN environment variable set, recursively chown all specified directories
# to match the user:group set in GOSU_USER environment variable.
if [ -n "$GOSU_CHOWN" ]; then
for DIR in $GOSU_CHOWN
do
chown -R "$GOSU_USER" "$DIR"
done
fi
if (( $(id -u) == 0 )); then
chown -R app:app /app || true
fi
# If GOSU_USER environment variable set to something other than 0:0 (root:root),
# become user:group set within and exec command passed in args
if [ -n "$GOSU_USER" ] && [ "$GOSU_USER" != "0:0" ]; then
IFS=':' read -r -a uidgid <<< "$GOSU_USER"
groupmod -o -g "${uidgid[1]}" app || true
usermod -u "${uidgid[0]}" -g "${uidgid[1]}" app
exec gosu "$GOSU_USER" "$@"
fi
# If GOSU_USER was 0:0 exec command passed in args without gosu (assume already root)
exec "$@"