Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

set -e

# Get UID/GID from volume dir
VOLUME_UID=$(stat -c '%u' $VOLUME_DIR)
VOLUME_GID=$(stat -c '%g' $VOLUME_DIR)

MY_UID=$(id -u)
MY_GID=$(id -g)

# Run as custom user
if [ "$MY_GID" != "$VOLUME_GID" ] || [ "$MY_UID" != "$VOLUME_UID" ]; then
if ! [ -w $VOLUME_DIR ]; then
# Get UID/GID from volume dir
VOLUME_UID=$(stat -c '%u' $VOLUME_DIR)
VOLUME_GID=$(stat -c '%g' $VOLUME_DIR)

# create or modify user and group to match expected uid/gid
groupadd --gid $VOLUME_GID archivist || groupmod -o --gid $VOLUME_GID archivist
useradd -ms /bin/bash -u $VOLUME_UID -g $VOLUME_GID archivist || usermod -o -u $VOLUME_UID archivist
Expand All @@ -36,4 +33,3 @@ else
# run process directly
exec $@
fi