feat(docker): run container as host user with bind-mounted workspace - #328
Conversation
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughDocker startup now aligns the container’s ChangesDocker workspace ownership
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant DockerEntrypoint
participant ContainerUserLibrary
participant AccountDatabase
participant Workspace
DockerEntrypoint->>ContainerUserLibrary: align_container_user node
ContainerUserLibrary->>AccountDatabase: validate and align PUID/PGID
DockerEntrypoint->>Workspace: warn_if_workspace_owner_differs
DockerEntrypoint->>Workspace: chown workspace and app paths
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…from environment values' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/lib/container-user.sh`:
- Around line 83-95: Update warn_if_workspace_owner_differs to accept and
compare the workspace’s group ID against the target GID in addition to the
existing UID check, and include both ownership values in the warning when either
differs. Update the scripts/docker-entrypoint.sh call site to pass
OCM_TARGET_GID, and adjust existing tests to cover matching and mismatched GIDs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 167f49a7-9a4f-4ece-a753-01c0920870ea
📒 Files selected for processing (10)
.env.exampleDockerfilebackend/test/helpers/repo-root.tsbackend/test/scripts/container-user.test.tsbackend/test/scripts/docker-config.test.tsdocker-compose.ymldocs/configuration/docker.mddocs/getting-started/installation.mdscripts/docker-entrypoint.shscripts/lib/container-user.sh
| spawnSync('bash', ['-c', 'set -e\nsource "$1"\neval "$2"', '--', libPath, snippet], { | ||
| encoding: 'utf-8', | ||
| env: { | ||
| ...process.env, | ||
| PUID: '', | ||
| PGID: '', | ||
| PATH: `${stubDir}:${process.env.PATH}`, | ||
| OCM_STUB_LOG: logPath, | ||
| ...env, | ||
| }, | ||
| }) |
Summary
Adds support for running the Manager container as a host-matched user so a bind-mounted workspace stays usable from the host without root.
scripts/lib/container-user.shaligns the in-imagenodeaccount's uid/gid toPUID/PGIDat startup, with conflict detection and a workspace-ownership warning before chown.docker-entrypoint.shsources the helper, aligns the container user, and re-chowns/appwhen ids change.docker-compose.ymlexposesPUID/PGID(default 1000) and binds/workspacetoOCM_WORKSPACE_HOST_PATHwhen set (falls back to the named volume)..env.exampledocuments the newOCM_WORKSPACE_HOST_PATH/PUID/PGIDknobs.docs/configuration/docker.mdanddocs/getting-started/installation.mddocument the host-workspace flow.Type of Change
Checklist
pnpm lintpasses locallypnpm typecheckpasses locallySummary by CodeRabbit
/workspaceto a host directory usingOCM_WORKSPACE_HOST_PATH.PUID/PGID(default1000), with automatic alignment at startup./appownership is only re-aligned when needed.PUID/PGID, workspace bind-mount/migration steps, and safer permission guidance.