Skip to content

Commit 0bb3037

Browse files
committed
Docker: Fix ownership of directories created in entrypoint.
1 parent 65e8561 commit 0bb3037

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

brev/entrypoint.bash

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ if [ "$(id -u)" = "0" ]; then
5858
ln -sf /accelerated-computing-hub/brev/ipython-startup-add-cwd-to-path.py "${HOME}/.ipython/profile_default/startup/00-add-cwd-to-path.py"
5959
fi
6060

61-
# Setup Git safe directory
62-
git config --global --add safe.directory "/accelerated-computing-hub" 2>/dev/null || true
61+
# Fix ownership of home directory contents (we created them as root)
62+
chown -R "${TARGET_USER}:$(id -gn ${TARGET_USER})" "${HOME}"
6363

64-
# Ensure logs directory exists and is writable
65-
mkdir -p /accelerated-computing-hub/logs 2>/dev/null || true
64+
# Setup Git safe directory (run as target user)
65+
gosu "${TARGET_USER}" git config --global --add safe.directory "/accelerated-computing-hub" 2>/dev/null || true
66+
67+
# Ensure logs directory exists and is writable by the user
68+
mkdir -p /accelerated-computing-hub/logs
69+
chown "${TARGET_USER}:$(id -gn ${TARGET_USER})" /accelerated-computing-hub/logs
6670
fi
6771

6872
# Dispatch to service-specific entrypoint

0 commit comments

Comments
 (0)