teleport/build.assets/Dockerfile-grpcbox
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

51 lines
1.7 KiB
Plaintext

FROM docker.io/golang:1.20
# Image layers go from less likely to most likely to change.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
npm \
unzip \
&& \
rm -rf /var/lib/apt/lists/*
# protoc-gen-gogofast
# Keep in sync with api/proto/buf.yaml (and buf.lock)
# eg, "v1.3.2"
ARG GOGO_PROTO_TAG
RUN go install "github.com/gogo/protobuf/protoc-gen-gogofast@$GOGO_PROTO_TAG"
# protoc-gen-js and protoc-gen-ts
# eg, "1.12.4"
ARG NODE_GRPC_TOOLS_VERSION
# eg, "5.0.1"
ARG NODE_PROTOC_TS_VERSION
RUN npm install --global "grpc-tools@$NODE_GRPC_TOOLS_VERSION" "grpc_tools_node_protoc_ts@$NODE_PROTOC_TS_VERSION"
# protoc
# eg, "3.20.2"
ARG PROTOC_VER
RUN VERSION="$PROTOC_VER" && \
PB_REL='https://github.com/protocolbuffers/protobuf/releases' && \
PB_FILE="$(mktemp protoc-XXXXXX.zip)" && \
ARCH="$(if [ "$(uname -m)" = aarch64 ]; then echo aarch_64; else uname -m; fi)" && \
curl -fsSL -o "$PB_FILE" "$PB_REL/download/v$VERSION/protoc-$VERSION-linux-$ARCH.zip" && \
unzip "$PB_FILE" -d /usr/local && \
rm -f "$PB_FILE"
# buf
# eg, "1.19.0"
ARG BUF_VERSION
RUN BIN='/usr/local/bin' && \
VERSION="$BUF_VERSION" && \
curl -fsSL "https://github.com/bufbuild/buf/releases/download/v$VERSION/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && \
chmod +x "$BIN/buf"
# Pre-install go-runned binaries.
# 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 github.com/bufbuild/connect-go/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