redox/docker/entrypoint.sh

19 lines
545 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2017-06-21 09:30:31 +02:00
# Use -e LOCAL_UID="$(id -u)" -e LOCAL_GID="$(id -g)"
# on the docker run command line if the container build user is different
# from the run user
2017-06-21 09:30:31 +02:00
CONT_UID=`id -u user`
CONT_GID=`id -g user`
RUN_UID=${LOCAL_UID:-$CONT_UID}
RUN_GID=${LOCAL_GID:-$CONT_GID}
2017-06-21 09:30:31 +02:00
if [ $RUN_UID != $CONT_UID ] || [ $RUN_GID != $CONT_GID ]; then
echo -e "\033[01;38;5;155mChanging user id:group to ${RUN_UID}:${RUN_GID}. Please wait...\033[0m"
groupmod -g $RUN_GID user
usermod -u $RUN_UID -g $RUN_GID user
fi
2017-06-21 09:30:31 +02:00
exec gosu user:user "$@"