Skip to content

Run SDK Docker builds as the host user - #575

Merged
jspaetzel merged 7 commits into
mainfrom
fix/sdk-docker-file-ownership
Nov 4, 2026
Merged

jspaetzel merged 7 commits into
mainfrom
fix/sdk-docker-file-ownership

Conversation

@jspaetzel

@jspaetzel jspaetzel commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • SDK Docker builds bind-mount the checkout. On rootful Docker they ran as root, so generated files could not be replaced by a later git checkout.
  • bin/docker-user-args keeps root:root on rootless Docker (container root is already the host user) and uses the host uid/gid on rootful Docker. bin/docker-run applies that to every SDK docker run.
  • PHP, Node, Python, Ruby, Java, and .NET wrappers, run-build, and the sandbox scripts use it. Package caches are host directories under .docker so the non-root user can write them. bin/redoc-container still runs as root because nginx binds port 80 and does not write the checkout.

Test plan

  • On rootful Docker, bin/docker-run -v "$PWD:/work" -w /work alpine touch probe creates a file owned by the host user
  • ./generate-sdks -t php (and one other language) leaves the SDK tree writable by the developer
  • Rootless Docker still builds (docker-user-args prints --user root:root)
  • DOCKER_RUN_AS_ROOT=1 restores the old root behavior

Container root owns generated files on a normal Docker daemon, so a later checkout cannot replace them. Rootless Docker still runs as container root because that user is already the host user.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jspaetzel
jspaetzel marked this pull request as ready for review October 12, 2026 21:00
@jspaetzel
jspaetzel marked this pull request as draft October 12, 2026 21:09
Shared docker-run and php-in-docker wrappers replace the copied root invocations, and package caches live in host .docker directories so a non-root user can write them.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jspaetzel jspaetzel changed the title Run PHP SDK Docker builds as the host user Run SDK Docker builds as the host user Oct 12, 2026
@jspaetzel
jspaetzel marked this pull request as ready for review October 12, 2026 21:18
Keep trunk's generator and runtime upgrades, and keep docker-run as the place that chooses the container user.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread bin/docker-run Resolved
@jspaetzel jspaetzel mentioned this pull request Nov 4, 2026
3 of 4 tasks
jspaetzel and others added 4 commits November 4, 2026 12:42
Co-authored-by: Cursor <cursoragent@cursor.com>
A directory glob covers new wrappers without listing each filename.

Co-authored-by: Cursor <cursoragent@cursor.com>
The workflow already watches these directories, and a new wrapper is picked up when it execs docker-run or php-in-docker.

Co-authored-by: Cursor <cursoragent@cursor.com>
The macOS Bash check now lives in hellosign/bash32-action, so this repo only passes the script globs.

Co-authored-by: Cursor <cursoragent@cursor.com>

@erkkinen erkkinen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jspaetzel
jspaetzel merged commit 6c68ce8 into main Nov 4, 2026
10 checks passed
@jspaetzel
jspaetzel deleted the fix/sdk-docker-file-ownership branch November 4, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants