forked from siemens/kas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint
executable file
·50 lines (41 loc) · 999 Bytes
/
docker-entrypoint
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
#!/bin/bash
if mount | grep -q "on / type aufs"; then
cat <<EOF >&2
WARNING: Generation of wic images will fail!
Your docker host setup uses broken aufs as storage driver. Adjust the docker
configuration to use a different driver (overlay, overlay2, devicemapper). You
may also need to update the host distribution (e.g. Debian Jessie -> Stretch).
EOF
fi
USER_ID=${USER_ID:-30000}
GROUP_ID=${GROUP_ID:-30000}
if [ $USER_ID == 0 ]; then
# We shall run everything as root
mkdir -p /builder
GOSU=""
else
if ! grep -q "^builder:" /etc/group; then
groupadd -o --gid $GROUP_ID builder
fi
if ! id builder >/dev/null 2>&1; then
# Create a non-root user that will perform the actual build
useradd -o --uid $USER_ID --gid $GROUP_ID --create-home \
--home-dir /builder builder
fi
GOSU="gosu builder"
fi
if [ "$PWD" = / ]; then
cd /builder
fi
if [ -n "$1" ]; then
case "$1" in
build|shell|-*)
exec $GOSU kas "$@"
;;
*)
exec $GOSU "$@"
;;
esac
else
exec $GOSU bash
fi