Skip to content

Commit

Permalink
Run buildenv as github actions user, fix buildifier not installed for…
Browse files Browse the repository at this point in the history
… all users
  • Loading branch information
djungelorm committed Jul 18, 2024
1 parent b326a91 commit 2a1e5d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tools/buildenv/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v3.4.3
* Run with github actions uid and gid
* Fix buildifier not installed for all users

v3.4.2
* Remove --distinct_host_configuration from bazelrc

Expand Down
8 changes: 6 additions & 2 deletions tools/buildenv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ RUN apt-get update && \
apt-get install -y --no-install-recommends golang && \
apt-get clean && \
git clone https://github.com/bazelbuild/buildtools.git --depth 1 --branch v7.1.2 && \
(cd buildtools/buildifier; go install)
ENV PATH="${PATH}:/root/go/bin"
(cd buildtools/buildifier; GOBIN=/usr/local/bin go install)

# Configure Bazel
COPY bazelrc /etc/bazel.bazelrc
RUN chmod 0644 /etc/bazel.bazelrc

WORKDIR /build

# Add github actions user
RUN groupadd -g 121 runner
RUN useradd -mr -d /home/runner -u 1001 -g 121 runner
RUN usermod -aG sudo runner
2 changes: 1 addition & 1 deletion tools/buildenv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build:
-t ghcr.io/krpc/buildenv:$(VERSION) .

test:
docker run -t -i ghcr.io/krpc/buildenv:$(VERSION)
docker run -t --user 1001:121 -i ghcr.io/krpc/buildenv:$(VERSION)

deploy:
docker push ghcr.io/krpc/buildenv:$(VERSION)
Expand Down
2 changes: 1 addition & 1 deletion tools/buildenv/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.2
3.4.3

0 comments on commit 2a1e5d0

Please sign in to comment.