Skip to content

Commit 2ddabe5

Browse files
committed
Provide default user / group IDs for alma9 rpmbuild docker
This is required for better compatibility with host platforms where the active uid (from id -u) might conflict with the base image system user ids. We chose 1000 as something outside the standard uid range, and conveniently the default uid on Ubuntu systems, ref: https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/uidrange.html I've also changed the Dockerfile to pick up the TARGETARCH value so that we get the right bazelisk executable.
1 parent 68349e2 commit 2ddabe5

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

contrib/alma9_rpmbuild_docker/docker/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
FROM almalinux:9.6
22

3-
ARG USER_ID
4-
ARG GROUP_ID
3+
ARG USER_ID=1000
4+
ARG GROUP_ID=1000
5+
ARG TARGETARCH
56

67
ENV BAZELISK_VERSION=v1.26.0
7-
ENV BAZELISK_URL=https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-amd64
8+
ENV BAZELISK_URL=https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-${TARGETARCH}
89

910
RUN dnf install -y \
1011
ca-certificates \

contrib/alma9_rpmbuild_docker/run.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ volume="${VOLUME:-bazel-cache}"
2121
dir=$(realpath "$(dirname "$0")")
2222
repo_root="$dir/../.."
2323

24-
docker build -t "$tag" --build-arg USER_ID="$(id -u)" --build-arg GROUP_ID="$(id -g)" "$dir/docker"
24+
USER_ID=${USER_ID:-1000}
25+
GROUP_ID=${GROUP_ID:-1000}
26+
(
27+
set -x
28+
docker build -t "$tag" --build-arg USER_ID="$USER_ID" --build-arg GROUP_ID="$GROUP_ID" "$dir/docker"
29+
)
2530

2631
docker_args=(
2732
-v "$volume":/home/devuser/.cache
@@ -31,4 +36,7 @@ docker_args=(
3136
-i
3237
-t
3338
)
34-
exec docker run "${docker_args[@]}" "$tag" "$@"
39+
(
40+
set -x
41+
exec docker run "${docker_args[@]}" "$tag" "$@"
42+
)

0 commit comments

Comments
 (0)