| # Copyright 2020 The Chromium OS Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| ARG BASE_REGISTRY_URI=us-docker.pkg.dev/chromeos-partner-moblab/base-containers | |
| FROM ${BASE_REGISTRY_URI}/debian:trixie-slim AS download | |
| RUN apt-get update && apt-get install --no-install-recommends -yq \ | |
| ca-certificates \ | |
| curl \ | |
| dh-autoreconf \ | |
| g++ \ | |
| gcc-multilib \ | |
| git \ | |
| make \ | |
| unzip \ | |
| zlib1g-dev | |
| WORKDIR / | |
| RUN curl -L -o protobuf.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_64.zip | |
| RUN unzip protobuf.zip | |
| RUN curl -L -o /usr/local/bin/protoc-gen-grpc-web https://github.com/grpc/grpc-web/releases/download/1.4.2/protoc-gen-grpc-web-1.4.2-linux-x86_64 | |
| RUN chmod uog+x /usr/local/bin/protoc-gen-grpc-web | |
| # install bazel | |
| RUN \ | |
| curl -sL https://github.com/bazelbuild/bazel/releases/download/6.4.0/bazel-6.4.0-linux-x86_64 > /usr/local/bin/bazel && \ | |
| chmod +x /usr/local/bin/bazel | |
| # build and install protoc-gen-js | |
| RUN \ | |
| git clone https://github.com/protocolbuffers/protobuf-javascript.git && \ | |
| cd protobuf-javascript && \ | |
| # b/349692635 | |
| git reset --hard 45fbfcb2776630f24b71ed44f0b5f7438d790d7a && \ | |
| bazel build //generator:protoc-gen-js && \ | |
| cp bazel-bin/generator/protoc-gen-js /usr/local/bin/protoc-gen-js | |
| ############################################################################## | |
| FROM ${BASE_REGISTRY_URI}/debian:trixie-slim | |
| RUN mkdir -p /protoc | |
| COPY --from=download bin/protoc /protoc | |
| COPY --from=download /include /protoc/include | |
| COPY --from=download /usr/local/bin/protoc-gen-grpc-web /protoc | |
| COPY --from=download /usr/local/bin/protoc-gen-js /protoc | |
| RUN cp -r /protoc/* /usr/local/bin/ | |