feat(docker): run container as host user with bind-mounted workspace (#328)

* feat(docker): run container as host user with bind-mounted workspace


* fix(docker): warn on workspace gid mismatch as well as uid

* fix(docker): eval snippet passed as positional arg in container-user tests

* docs(installation): drop stale host repository access reference
This commit is contained in:
Chris Scott authored and GitHub committed 2026-07-28 11:30:50 -04:00
1 parent a73ac19bbc
commit 6c635397ba
10 files changed
+743 -4

No files matched your search

+13
View File
@@ -5,6 +5,8 @@ export HOME=/home/node
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$HOME/.opencode/bin:/usr/local/bin:$PATH"
source /usr/local/lib/ocm/container-user.sh
install_opencode() {
echo "Installing OpenCode latest..."
curl -fsSL "https://github.com/anomalyco/opencode/releases/latest/download/opencode-linux-$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/').tar.gz" \
@@ -86,7 +88,18 @@ if [ -z "$AUTH_SECRET" ]; then
exit 1
fi
if ! align_container_user node; then
exit 1
fi
warn_if_workspace_owner_differs /workspace "$OCM_TARGET_UID" "$OCM_TARGET_GID"
mkdir -p /app/data /workspace /home/node/.cache /home/node/.opencode
chown -R node:node /app/data /workspace /home/node
if [ "$OCM_UID_CHANGED" = "1" ] || [ "$OCM_GID_CHANGED" = "1" ]; then
echo "Realigning /app ownership after id change"
chown -R node:node /app
fi
exec runuser -u node -- "$@"