From 5586f1881686f436e3cb4352058f5ad2dd3f07bd Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 13 Jul 2025 20:45:07 -0700 Subject: [PATCH] Improve ownership check and chown handling for .next --- docker-entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 99379de1e..4aa03074d 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -44,9 +44,15 @@ fi if [ -d /app/.next ]; then CURRENT_UID=$(stat -c %u /app/.next) - if [ "$CURRENT_UID" -ne "$PUID" ]; then + CURRENT_GID=$(stat -c %g /app/.next) + + if [ "$CURRENT_UID" -ne "$PUID" ] || [ "$CURRENT_GID" -ne "$PGID" ]; then echo "Fixing ownership of /app/.next" - chown -R "$PUID:$PGID" /app/.next || echo "Warning: Could not chown /app/.next" + if ! chown -R "$PUID:$PGID" /app/.next 2>/dev/null; then + echo "Warning: Could not chown /app/.next; continuing anyway" + fi + else + echo "/app/.next already owned by correct UID/GID, skipping chown" fi fi