-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-entrypoint.sh
34 lines (29 loc) · 1.17 KB
/
docker-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/bash
set -e
. /home/wtuser/venv/bin/activate
girder-worker-config set celery backend ${CELERY_BACKEND:-redis://redis/}
girder-worker-config set celery broker ${CELERY_BROKER:-redis://redis/}
girder-worker-config set girder_worker tmp_root /tmp
if [[ -n "$DEV" ]] ; then
python3 -m pip install -e /girderfs
python3 -m pip install -r /gwvolman/requirements.txt -e /gwvolman
fi
# 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_UID:$GOSU_GID $DIR
done
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 [ "$GOSU_USER" != "0:0" ]; then
IFS=: read GOSU_UID GOSU_GID DOCKER_GROUP <<<"${GOSU_USER}"
groupadd -g $DOCKER_GROUP docker
gpasswd -a wtuser docker
usermod -g $GOSU_GID wtuser
exec gosu $GOSU_UID python3 -m girder_worker -l INFO "$@"
fi
# If GOSU_USER was 0:0 exec command passed in args without gosu (assume already root)
exec python3 -m girder_worker -l INFO "$@"