diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index 865a9929..65a4c1f6 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -3,6 +3,14 @@ DATA_DIR="${DATA_DIR:-/data}" ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}" +# Set the archivebox user UID & GID +if [[ -n "$PUID" && "$PUID" != 0 ]]; then + usermod -u "$PUID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 +fi +if [[ -n "$PGID" && "$PGID" != 0 ]]; then + groupmod -g "$PGID" "$ARCHIVEBOX_USER" > /dev/null 2>&1 +fi + # Set the permissions of the data dir to match the archivebox user if [[ -d "$DATA_DIR/archive" ]]; then # check data directory permissions