From 4c73138baa6263888ba705556bd682a3396ade2d Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 11:43:13 -0700 Subject: [PATCH 01/16] Add docker build --- .dockerignore | 18 ++++++++++++++++++ Dockerfile | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..00ee931 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +# CMake ignores +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +# Project specific +cmake/* +!cmake/.gitkeep +node_modules +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f642ec6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:16-bullseye as build +RUN apt-get update && apt-get install -y cmake protobuf-compiler libgrpc++1 libgrpc++-dev libgrpc-dev libgrpc10 python3-venv wget && rm -rf /var/lib/apt/lists/* +RUN rm -rf /go && wget https://golang.google.cn/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz +ENV GOPATH=/go +ENV PATH $GOPATH/bin:$PATH +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" +RUN go install github.com/golang/protobuf/protoc-gen-go@v1.5.2 +COPY . /build/ +WORKDIR /build +RUN cmake . && cmake --build . + +FROM debian:bullseye-slim +COPY --from=build /build/gooseai /gooseai \ No newline at end of file From 5d0a3b1bb334f2439b9f6744a23338adfe5d5632 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 11:46:59 -0700 Subject: [PATCH 02/16] use better URL for golang install --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f642ec6..4854c94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM node:16-bullseye as build RUN apt-get update && apt-get install -y cmake protobuf-compiler libgrpc++1 libgrpc++-dev libgrpc-dev libgrpc10 python3-venv wget && rm -rf /var/lib/apt/lists/* -RUN rm -rf /go && wget https://golang.google.cn/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz +RUN rm -rf /go && wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz ENV GOPATH=/go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" From 97fc8057e8b91794fce4ba3abbe0d9965cada8d0 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 14:34:00 -0700 Subject: [PATCH 03/16] Build protobuf and grpc to use latest --- Dockerfile | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4854c94..eff62fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,31 @@ -FROM node:16-bullseye as build -RUN apt-get update && apt-get install -y cmake protobuf-compiler libgrpc++1 libgrpc++-dev libgrpc-dev libgrpc10 python3-venv wget && rm -rf /var/lib/apt/lists/* +FROM node:16-bullseye as builder +RUN apt-get update && apt-get install -y cmake git autoconf automake libtool pkg-config g++ python3-venv wget && rm -rf /var/lib/apt/lists/* + +# Install golang RUN rm -rf /go && wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz ENV GOPATH=/go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" -RUN go install github.com/golang/protobuf/protoc-gen-go@v1.5.2 -COPY . /build/ +RUN mkdir -p /build + +# Build protobuf WORKDIR /build +RUN git clone --recurse-submodules -b v21.6 --depth 1 --shallow-submodules https://github.com/protocolbuffers/protobuf.git && cd protobuf +WORKDIR /build/protobuf/cmake +RUN cmake . && cmake --build . --parallel 10 && cmake --install . + +# Build GRPC +WORKDIR /build +RUN git clone --recurse-submodules -b v1.48.1 --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 && make install + +# Build api-interfaces +RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 +COPY . /build/api-interfaces +WORKDIR /build/api-interfaces RUN cmake . && cmake --build . +# Copy output to a bare container FROM debian:bullseye-slim -COPY --from=build /build/gooseai /gooseai \ No newline at end of file +COPY --from=builder /build/api-interfaces/gooseai /gooseai \ No newline at end of file From 40db68ac7fbad2bcfadf37f52c12dee58c021dca Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 15:59:05 -0700 Subject: [PATCH 04/16] Ignore protoc output in docker build --- .dockerignore | 5 +++++ Dockerfile | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index 00ee931..393c1e3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,3 +16,8 @@ cmake/* !cmake/.gitkeep node_modules .idea + +# protoc output +gooseai/* +!gooseai/go.* +!gooseai/__init__.py \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index eff62fd..2b6bf88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM node:16-bullseye as builder -RUN apt-get update && apt-get install -y cmake git autoconf automake libtool pkg-config g++ python3-venv wget && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y cmake git build-essential python3-venv wget && rm -rf /var/lib/apt/lists/* # Install golang RUN rm -rf /go && wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz @@ -22,9 +22,8 @@ RUN mkdir -p cmake/build; cd cmake/build; cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_T # Build api-interfaces RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 -COPY . /build/api-interfaces -WORKDIR /build/api-interfaces -RUN cmake . && cmake --build . +COPY . /build/api-interfaces/ +RUN cd /build/api-interfaces && cmake . && cmake --build . # Copy output to a bare container FROM debian:bullseye-slim From 845ab475b701d0c87f726ac563c4f7973757281d Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 16:16:29 -0700 Subject: [PATCH 05/16] Add build action --- .github/workflows/docker.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..0926618 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,18 @@ +name: Build Docker Image + +on: + push: {} + +jobs: + build-with-docker: + name: Build with Docker + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + - uses: docker/build-push-action@v3 + with: + push: false + context: . + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From 5bf714162744c01e355b2ac0dc03e268da82c398 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 16:41:40 -0700 Subject: [PATCH 06/16] Use docker output --- .github/workflows/docker.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0926618..4dac74d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,4 +15,9 @@ jobs: push: false context: . cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max + outputs: | + type=local,dest=${{ runner.temp }}/docker-build + - name: Copy output files + run: | + cp -r ${{ runner.temp }}/docker-build/gooseai ${{GITHUB_WORKSPACE}} \ No newline at end of file From f8e2d6a38e2b70e34286a58c23102808ba4ce1b2 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 16:44:39 -0700 Subject: [PATCH 07/16] Fix workspace path --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4dac74d..74b1af7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,4 +20,4 @@ jobs: type=local,dest=${{ runner.temp }}/docker-build - name: Copy output files run: | - cp -r ${{ runner.temp }}/docker-build/gooseai ${{GITHUB_WORKSPACE}} \ No newline at end of file + cp -r ${{ runner.temp }}/docker-build/gooseai $GITHUB_WORKSPACE \ No newline at end of file From fbf8a5d9981bd6f58c6b46105f3015d78b6ac0a8 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 17:09:16 -0700 Subject: [PATCH 08/16] Switch back to packaged grpc as GH build fails --- Dockerfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b6bf88..3dd9079 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM node:16-bullseye as builder -RUN apt-get update && apt-get install -y cmake git build-essential python3-venv wget && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y cmake git build-essential libgrpc++1 libgrpc++-dev libgrpc-dev libgrpc10 python3-venv wget && rm -rf /var/lib/apt/lists/* # Install golang RUN rm -rf /go && wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz @@ -14,12 +14,6 @@ RUN git clone --recurse-submodules -b v21.6 --depth 1 --shallow-submodules https WORKDIR /build/protobuf/cmake RUN cmake . && cmake --build . --parallel 10 && cmake --install . -# Build GRPC -WORKDIR /build -RUN git clone --recurse-submodules -b v1.48.1 --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 && make install - # Build api-interfaces RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 COPY . /build/api-interfaces/ From 3947435a5c40f0b3b86e5444ac9629f262b9e075 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 18:12:07 -0700 Subject: [PATCH 09/16] Remove protobuf build, restore grpc --- Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3dd9079..d05a183 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM node:16-bullseye as builder -RUN apt-get update && apt-get install -y cmake git build-essential libgrpc++1 libgrpc++-dev libgrpc-dev libgrpc10 python3-venv wget && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y cmake git build-essential python3-venv wget && rm -rf /var/lib/apt/lists/* # Install golang RUN rm -rf /go && wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz @@ -8,16 +8,17 @@ ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" RUN mkdir -p /build -# Build protobuf +# Build GRPC; note this issue before updating: https://github.com/protocolbuffers/protobuf-javascript/issues/127 WORKDIR /build -RUN git clone --recurse-submodules -b v21.6 --depth 1 --shallow-submodules https://github.com/protocolbuffers/protobuf.git && cd protobuf -WORKDIR /build/protobuf/cmake -RUN cmake . && cmake --build . --parallel 10 && cmake --install . +RUN git clone --recurse-submodules -b v1.48.2 --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 # Build api-interfaces RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 COPY . /build/api-interfaces/ -RUN cd /build/api-interfaces && cmake . && cmake --build . +WORKDIR /build/api-interfaces +RUN cmake . && cmake --build . # Copy output to a bare container FROM debian:bullseye-slim From c0603b5a844f547eefa1a9abd90674065c8d951b Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 18:34:46 -0700 Subject: [PATCH 10/16] Upload artifacts --- .github/workflows/docker.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 74b1af7..371f92e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -17,7 +17,8 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max outputs: | - type=local,dest=${{ runner.temp }}/docker-build - - name: Copy output files - run: | - cp -r ${{ runner.temp }}/docker-build/gooseai $GITHUB_WORKSPACE \ No newline at end of file + type=local,dest=${{ runner.temp }}/docker-build + - uses: action/upload-artifact@v3 + with: + name: gooseai + path: ${{ runner.temp }}/docker-build/gooseai \ No newline at end of file From 461040ca036c07c36b8292575a3ba5e08b1896aa Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 18:35:24 -0700 Subject: [PATCH 11/16] Fix typo --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 371f92e..cdd4a8c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,7 +18,7 @@ jobs: cache-to: type=gha,mode=max outputs: | type=local,dest=${{ runner.temp }}/docker-build - - uses: action/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: name: gooseai path: ${{ runner.temp }}/docker-build/gooseai \ No newline at end of file From e4612a9dea7a55e749a64edf8fad1d0f61c3aa1b Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 18:47:10 -0700 Subject: [PATCH 12/16] Fix ignore pattern --- .dockerignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 393c1e3..da31d1b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,6 +18,4 @@ node_modules .idea # protoc output -gooseai/* -!gooseai/go.* -!gooseai/__init__.py \ No newline at end of file +gooseai/*/*pb* From cbfaf65cc4a1a50058c4aed837b93b43ba2a649f Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 21:23:04 -0700 Subject: [PATCH 13/16] Fix grpc-web build --- CMakeLists.txt | 2 +- Dockerfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee0126..d03b7d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ set(javascript_grpc_exts "_grpc_pb.js") set(typescript_web_exec "protoc") set(typescript_web_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts") set(typescript_web_args "") -set(typescript_web_output "--ts_out=service=grpc-web:") +set(typescript_web_output "--grpc-web_out=import_style=typescript,mode=grpcweb:") set(typescript_web_output_dir "${PROJECT_SOURCE_DIR}/gooseai") file(MAKE_DIRECTORY "${typescript_output_dir}") set(typescript_web_exts "_grpc_pb_service.d.ts;_grpc_pb_service.js") diff --git a/Dockerfile b/Dockerfile index d05a183..661030e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ WORKDIR /build RUN git clone --recurse-submodules -b v1.48.2 --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 +RUN wget https://github.com/grpc/grpc-web/releases/download/1.4.0/protoc-gen-grpc-web-1.4.0-linux-x86_64 -qO /usr/local/bin/protoc-gen-grpc-web && chmod +x /usr/local/bin/protoc-gen-grpc-web # Build api-interfaces RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 From 1d2cb05b660b872f9e7e34770805c55d89dd52e6 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 21:31:13 -0700 Subject: [PATCH 14/16] Fix typescript generation --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d03b7d5..b1e84d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ set(javascript_grpc_exts "_grpc_pb.js") set(typescript_web_exec "protoc") set(typescript_web_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts") set(typescript_web_args "") -set(typescript_web_output "--grpc-web_out=import_style=typescript,mode=grpcweb:") +set(typescript_web_output "--grpc-web_out=import_style=commonjs+dts,mode=grpcweb:") set(typescript_web_output_dir "${PROJECT_SOURCE_DIR}/gooseai") file(MAKE_DIRECTORY "${typescript_output_dir}") set(typescript_web_exts "_grpc_pb_service.d.ts;_grpc_pb_service.js") From cd90bcb4fb0df778af1cb3736180d7715f78d38f Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Mon, 26 Sep 2022 22:02:06 -0700 Subject: [PATCH 15/16] revert grpc-web changes --- CMakeLists.txt | 2 +- Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1e84d8..3ee0126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ set(javascript_grpc_exts "_grpc_pb.js") set(typescript_web_exec "protoc") set(typescript_web_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts") set(typescript_web_args "") -set(typescript_web_output "--grpc-web_out=import_style=commonjs+dts,mode=grpcweb:") +set(typescript_web_output "--ts_out=service=grpc-web:") set(typescript_web_output_dir "${PROJECT_SOURCE_DIR}/gooseai") file(MAKE_DIRECTORY "${typescript_output_dir}") set(typescript_web_exts "_grpc_pb_service.d.ts;_grpc_pb_service.js") diff --git a/Dockerfile b/Dockerfile index 661030e..e5f89f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,10 +13,11 @@ WORKDIR /build RUN git clone --recurse-submodules -b v1.48.2 --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 -RUN wget https://github.com/grpc/grpc-web/releases/download/1.4.0/protoc-gen-grpc-web-1.4.0-linux-x86_64 -qO /usr/local/bin/protoc-gen-grpc-web && chmod +x /usr/local/bin/protoc-gen-grpc-web # Build api-interfaces +RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0 RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 + COPY . /build/api-interfaces/ WORKDIR /build/api-interfaces RUN cmake . && cmake --build . From 5a0a26551bc03ebfed1e70b110186a39c4f89007 Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Wed, 28 Sep 2022 09:19:02 -0700 Subject: [PATCH 16/16] Paramaterize versions in Dockerfile --- Dockerfile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index e5f89f7..c863923 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,16 @@ -FROM node:16-bullseye as builder +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 + +# 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/* -# Install golang -RUN rm -rf /go && wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz -qO- | tar -C / -xz +# Install golang from binary package +RUN rm -rf /go && wget ${GOLANG_PACKAGE} -qO- | tar -C / -xz ENV GOPATH=/go ENV PATH $GOPATH/bin:$PATH RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" @@ -10,13 +18,13 @@ RUN mkdir -p /build # Build GRPC; note this issue before updating: https://github.com/protocolbuffers/protobuf-javascript/issues/127 WORKDIR /build -RUN git clone --recurse-submodules -b v1.48.2 --depth 1 --shallow-submodules https://github.com/grpc/grpc +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 # Build api-interfaces -RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0 -RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 +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} COPY . /build/api-interfaces/ WORKDIR /build/api-interfaces