Merge pull request #8576 from IfcOpenShell/fix/docker-macos-arm64-compat

docker: more robust in getting a GID, and editing the .env file.
This commit is contained in:
sboddy
2026-07-13 13:09:29 +01:00
committed by GitHub
2 changed files with 19 additions and 2 deletions
+9 -1
View File
@@ -42,7 +42,15 @@ ENV PATH="/usr/lib/ccache:$PATH"
# if your host user has a different UID/GID.
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -g "${USER_GID}" builder \
# groupadd fails outright if USER_GID is already taken by an existing
# system group - which happens whenever a host's primary GID collides with
# one baked into the rockylinux9 base image. The main real-world case is
# macOS, where the default user's primary group is "staff" at GID 20, and
# GID 20 is "games" on RHEL-family images. Only create the "builder" group
# when that GID is actually free; otherwise useradd just attaches to
# whichever group already owns it. Either way the builder user ends up
# with the right GID for bind-mount ownership, which is all that matters.
RUN (getent group "${USER_GID}" >/dev/null || groupadd -g "${USER_GID}" builder) \
&& useradd -m -u "${USER_UID}" -g "${USER_GID}" -s /bin/bash builder \
&& echo "builder ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/builder