fix: handle user UID/GID

This commit is contained in:
Glenn Y. Rolland 2021-11-30 15:01:01 +01:00
parent dd5b7d8591
commit 141b1e33f2
2 changed files with 9 additions and 2 deletions

View file

@ -9,7 +9,12 @@ echo "Arguments: $ARGS"
EXT_UID=${EXT_UID:-999} EXT_UID=${EXT_UID:-999}
EXT_GID=${EXT_GID:-999} EXT_GID=${EXT_GID:-999}
if ! grep "^[^:]*:[^:]*:$EXT_UID:" /etc/group ; then
groupadd -g "$EXT_GID" appuser groupadd -g "$EXT_GID" appuser
fi
if ! grep "^[^:]*:[^:]*:$EXT_UID:" /etc/passwd ; then
useradd -r -u "$EXT_UID" -g appuser appuser useradd -r -u "$EXT_UID" -g appuser appuser
fi
exec gosu appuser make "$@" exec gosu appuser make "$@"

View file

@ -26,6 +26,8 @@ docker run -it \
-v "$BASEDIR/images:/app/images" \ -v "$BASEDIR/images:/app/images" \
-v "$BASEDIR/_build:/app/_build" \ -v "$BASEDIR/_build:/app/_build" \
-v "$BASEDIR/mkdocs.yml:/app/mkdocs.yml" \ -v "$BASEDIR/mkdocs.yml:/app/mkdocs.yml" \
-e "EXT_UID=$(id -u)" \
-e "EXT_GID=$(id -g)" \
$DOCKER_OPT_MARP_THEME \ $DOCKER_OPT_MARP_THEME \
-p 5200:5200 \ -p 5200:5200 \
-p 5100:5100 \ -p 5100:5100 \