forked from unjx-de/launchpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
34 lines (29 loc) · 876 Bytes
/
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
#!/bin/sh
cat logo.txt
APP=app
if [ -n "$PUID" ] || [ -n "$PGID" ]; then
USER=appuser
HOME=/"$APP"
if ! grep -q "$USER" /etc/passwd; then
# Usage: addgroup [-g GID] [-S] [USER] GROUP
#
# Add a group or add a user to a group
# -g GID Group id
addgroup -g "$PGID" "$USER"
# Usage: adduser [OPTIONS] USER [GROUP]
# Create new user, or add USER to GROUP
# -h DIR Home directory
# -g GECOS GECOS field
# -G GRP Group
# -D Don't assign a password
# -H Don't create home directory
# -u UID User id
adduser -h "$HOME" -g "" -G "$USER" -D -H -u "$PUID" "$USER"
fi
chown "$USER":"$USER" "$HOME" -R
printf "UID: %s GID: %s\n\n" "$PUID" "$PGID"
exec su -c - $USER ./"$APP"
else
printf "WARNING: Running docker as root\n\n"
exec ./"$APP"
fi