teleport/build.assets/grpcbox.mk
Jakub Nyckowski 9b1a657ade
Allow overriding docker in make grpc (#27268)
* Set the correct file permission on make grpc

https://github.com/gravitational/teleport/pull/26640 introduced the new GRPC buildbox. The new Docker image uses the default user (root) which changes the generated files owner on all generates files.
This PR sets XDG_CACHE_HOME to allow buf to run as a provided user.

Note: This is mainly Linux issue, as MacOS does not change the owner of modified files in mounted volumes.

* Use podman for GRPC generation

* Remove docker override on Linux

* Restore example ARG values

* Update build.assets/Dockerfile-grpcbox

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>

---------

Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
2023-06-02 16:02:40 +00:00

37 lines
1.2 KiB
Makefile

# Makefile for grpcbox targets and variables.
#
# The grpcbox is a leaner, meaner, faster buildbox meant exclusively for
# codegen.
# It is not guaranteed to have tooling parity with the buildbox.
#
# See Dockerfile-grpcbox.
GRPCBOX_BASE_NAME ?= teleport-grpcbox
ifeq ($(BUILDBOX_VERSION), "")
GRPCBOX ?= $(GRPCBOX_BASE_NAME)
else
GRPCBOX ?= $(GRPCBOX_BASE_NAME):$(BUILDBOX_VERSION)
endif
# Allow overriding the docker implementation to use for ex. podman.
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)
# grpcbox builds a codegen-focused buildbox.
# It's leaner, meaner, faster and not supposed to compile code.
.PHONY: grpcbox
grpcbox:
DOCKER_BUILDKIT=1 $(DOCKER) build \
--build-arg BUF_VERSION=$(BUF_VERSION) \
--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 PROTOC_VER=$(PROTOC_VER) \
-f Dockerfile-grpcbox \
-t "$(GRPCBOX)" \
../