constellation/proto/Dockerfile.gen-proto

64 lines
2.4 KiB
Docker
Raw Normal View History

FROM ubuntu@sha256:7cc0576c7c0ec2384de5cbf245f41567e922aab1b075f3e8ad565f508032df17 as build
2022-10-06 13:31:12 -04:00
ARG GO_VER=1.19.2
ARG GEN_GO_VER=1.28.0
ARG GEN_GO_GRPC_VER=1.2.0
ARG PB_VER=3.20.1
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get install -y wget tar unzip
# Install Go
2022-09-02 06:45:56 -04:00
RUN wget -q https://go.dev/dl/go${GO_VER}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GO_VER}.linux-amd64.tar.gz && rm go${GO_VER}.linux-amd64.tar.gz
ENV PATH ${PATH}:/usr/local/go/bin:/root/go/bin
2022-09-02 06:45:56 -04:00
RUN wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PB_VER}/protoc-${PB_VER}-linux-x86_64.zip && \
unzip protoc-${PB_VER}-linux-x86_64.zip -d /root/.local && \
cp /root/.local/bin/protoc /usr/local/bin/protoc
ENV PATH="$PATH:/root/.local/bin"
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GEN_GO_VER} && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v${GEN_GO_GRPC_VER}
# Generate code for every existing proto file
## disk-mapper recover api
WORKDIR /disk-mapper
COPY disk-mapper/recoverproto/*.proto /disk-mapper
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
## debugd service
WORKDIR /service
COPY debugd/service/*.proto /service
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
## key management
WORKDIR /kms
COPY kms/kmsproto/*.proto /kms
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
2022-07-05 05:41:31 -04:00
## join service
WORKDIR /joinservice
COPY joinservice/joinproto/*.proto /joinservice
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
## verify
WORKDIR /verify
COPY verify/verifyproto/*.proto /verify
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
2022-06-21 11:59:12 -04:00
## init
WORKDIR /init
COPY bootstrapper/initproto/*.proto /init
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
FROM scratch as export
COPY --from=build /disk-mapper/*.go disk-mapper/recoverproto/
COPY --from=build /service/*.go debugd/service/
COPY --from=build /kms/*.go kms/kmsproto/
2022-07-05 05:41:31 -04:00
COPY --from=build /joinservice/*.go joinservice/joinproto/
COPY --from=build /verify/*.go verify/verifyproto/
COPY --from=build /init/*.go bootstrapper/initproto/