diff --git a/build.assets/Dockerfile-grpcbox b/build.assets/Dockerfile-grpcbox index c93cfc02e8691..df146ce0a75c7 100644 --- a/build.assets/Dockerfile-grpcbox +++ b/build.assets/Dockerfile-grpcbox @@ -33,7 +33,13 @@ RUN VERSION="$BUF_VERSION"; \ # This is meant to be the only step that changes depending on the Teleport # branch. COPY go.mod go.sum /teleport-module/ + RUN cd /teleport-module; \ go install connectrpc.com/connect/cmd/protoc-gen-connect-go && \ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc && \ go install google.golang.org/protobuf/cmd/protoc-gen-go + +ARG UID +ARG GID +RUN mkdir -p /.cache /.npm && \ + chown -R $UID:$GID /.cache /.npm /go/pkg/mod/ diff --git a/build.assets/grpcbox.mk b/build.assets/grpcbox.mk index 78ab44e73c098..2cd80b1046969 100644 --- a/build.assets/grpcbox.mk +++ b/build.assets/grpcbox.mk @@ -19,7 +19,9 @@ DOCKER ?= docker # GRPCBOX_RUN has the necessary invocation to run a command inside the grpcbox. # Use this variable to run it from other Makefiles. -GRPCBOX_RUN := $(DOCKER) run -it --rm -v "$$(pwd)/../:/workdir" -w /workdir $(GRPCBOX) +UID := $$(id -u) +GID := $$(id -g) +GRPCBOX_RUN := $(DOCKER) run -it --rm -u $(UID):$(GID) -v "$$(pwd)/../:/workdir" -w /workdir $(GRPCBOX) # grpcbox builds a codegen-focused buildbox. # It's leaner, meaner, faster and not supposed to compile code. @@ -30,6 +32,7 @@ grpcbox: --build-arg GOGO_PROTO_TAG=$(GOGO_PROTO_TAG) \ --build-arg NODE_GRPC_TOOLS_VERSION=$(NODE_GRPC_TOOLS_VERSION) \ --build-arg NODE_PROTOC_TS_VERSION=$(NODE_PROTOC_TS_VERSION) \ + --build-arg UID=$(UID) --build-arg GID=$(GID) \ -f Dockerfile-grpcbox \ -t "$(GRPCBOX)" \ ../