-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using latest protobuf version, fixing protoc-gen-js install... #30
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,12 @@ ARG NODE_IMAGE_TAG=16-bullseye | |
FROM node:${NODE_IMAGE_TAG} as builder | ||
ARG GOLANG_VERSION=1.18.6 | ||
ARG GOLANG_PACKAGE=https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz | ||
ARG GRPC_VERSION=v1.48.2 | ||
ARG PROTOC_GEN_GO_VERSION=v1.28.1 | ||
ARG PROTOC_GEN_GO_GRPC_VERSION=v1.1.0 | ||
ARG GRPC_VERSION=v1.50.0 | ||
# In newer versions of gRPC, the protoc-gen-js plugin has been moved to a separate repository | ||
# https://github.com/protocolbuffers/protobuf-javascript/releases | ||
ARG PROTOBUF_JAVASCRIPT_VERSION=3.21.2 | ||
|
||
# Install python and build tools from apt | ||
RUN apt-get update && apt-get install -y cmake git build-essential python3-venv wget && rm -rf /var/lib/apt/lists/* | ||
|
@@ -16,12 +19,20 @@ ENV PATH $GOPATH/bin:$PATH | |
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" | ||
RUN mkdir -p /build | ||
|
||
# Build GRPC; note this issue before updating: https://github.com/protocolbuffers/protobuf-javascript/issues/127 | ||
# Build gRPC | ||
WORKDIR /build | ||
RUN git clone --recurse-submodules -b ${GRPC_VERSION} --depth 1 --shallow-submodules https://github.com/grpc/grpc | ||
WORKDIR /build/grpc | ||
RUN mkdir -p cmake/build; cd cmake/build; cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ../.. && make -j 8 && make install | ||
|
||
# Install protoc-gen-js | ||
WORKDIR /build/protoc-gen-js | ||
RUN wget -O protobuf-javascript.zip https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${PROTOBUF_JAVASCRIPT_VERSION}/protobuf-javascript-${PROTOBUF_JAVASCRIPT_VERSION}-linux-x86_64.zip && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap these super-long lines please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would seem to me that doing a git checkout to a release branch is a lot less brittle than this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To be clear, are you suggesting that we do a git checkout of the release branch and build the binary in docker instead of using the pre-built binary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. Maybe? It would allow the protobufs to be built on non-x86-64 containers, but I'm not sure if this is relevant. |
||
unzip protobuf-javascript.zip -d ./protobuf-javascript && \ | ||
mv ./protobuf-javascript/bin/protoc-gen-js /usr/local/bin && \ | ||
rm -rf ./protobuf-javascript && \ | ||
rm protobuf-javascript.zip | ||
|
||
# Build api-interfaces | ||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION} | ||
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} | ||
|
@@ -34,5 +45,5 @@ WORKDIR /build/api-interfaces | |
RUN cmake . && make clean && cmake --build . | ||
|
||
# Copy output to a bare container | ||
FROM debian:bullseye-slim | ||
FROM scratch | ||
wbrown marked this conversation as resolved.
Show resolved
Hide resolved
|
||
COPY --from=builder /build/api-interfaces/gooseai /gooseai |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
|
||
# Enable docker buildkit in order to use the --output flag | ||
export DOCKER_BUILDKIT=1 | ||
|
||
docker build --output type=local,dest=$scriptdir $scriptdir |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this impact the Python build? There's specific reasons why we selected this gRPC version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm inclined to say no since the generated python output hasn't changed, but I could verify this with local testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no, then ok. Do verify quickly, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version of
protoc
built here is not used, see here:#27