Browse Source

build(docker): Make chown logic smarter in entrypoint (#16852)

Implements the logic from https://git.io/JvZ1G which @mattrobenolt brought up recently.
Burak Yigit Kaya 5 years ago
parent
commit
83b138090a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      docker/docker-entrypoint.sh

+ 4 - 1
docker/docker-entrypoint.sh

@@ -16,7 +16,10 @@ if [ "$1" = 'sentry' ]; then
 	set -- tini -- "$@"
 	if [ "$(id -u)" = '0' ]; then
 		mkdir -p /data/files
-		find /data ! -user sentry -exec chown sentry {} \;
+		sentry_uid=$(id -u sentry)
+		if [ "$(stat -c %u /data)" != "$sentry_uid" || "$(stat -c %u /data/files)" != "$sentry_uid" ]; then
+			find /data ! -user sentry -exec chown sentry {} \;
+		fi
 		set -- gosu sentry "$@"
 	fi
 fi