2022-03-22 11:03:15 -04:00
|
|
|
FROM ubuntu@sha256:7cc0576c7c0ec2384de5cbf245f41567e922aab1b075f3e8ad565f508032df17 as build
|
|
|
|
|
2022-04-12 08:24:36 -04:00
|
|
|
ARG GO_VER=1.18
|
2022-04-28 04:28:50 -04:00
|
|
|
ARG GEN_GO_VER=1.28.0
|
|
|
|
ARG GEN_GO_GRPC_VER=1.2.0
|
|
|
|
ARG PB_VER=3.20.1
|
2022-03-22 11:03:15 -04:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND="noninteractive"
|
|
|
|
RUN apt-get update && apt-get install -y wget tar unzip
|
|
|
|
|
|
|
|
# Install Go
|
|
|
|
RUN wget 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
|
|
|
|
|
|
|
|
|
|
|
|
RUN wget 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
|
2022-04-12 08:24:36 -04:00
|
|
|
|
|
|
|
## Coordinator pubapi
|
2022-03-22 11:03:15 -04:00
|
|
|
WORKDIR /pubapi
|
2022-04-12 08:24:36 -04:00
|
|
|
COPY coordinator/pubapi/pubproto/*.proto /pubapi
|
2022-03-22 11:03:15 -04:00
|
|
|
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
|
2022-04-12 08:24:36 -04:00
|
|
|
|
|
|
|
## Coordinator vpnapi
|
2022-03-22 11:03:15 -04:00
|
|
|
WORKDIR /vpnapi
|
2022-04-12 08:24:36 -04:00
|
|
|
COPY coordinator/vpnapi/vpnproto/*.proto /vpnapi
|
|
|
|
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
|
|
|
|
|
|
|
|
## disk-mapper keyservice api
|
|
|
|
WORKDIR /disk-mapper
|
2022-04-11 08:25:19 -04:00
|
|
|
COPY state/keyservice/keyproto/*.proto /disk-mapper
|
2022-03-22 11:03:15 -04:00
|
|
|
RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
|
|
|
|
|
2022-04-12 08:24:36 -04:00
|
|
|
## 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
|
|
|
|
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
FROM scratch as export
|
2022-04-12 08:24:36 -04:00
|
|
|
COPY --from=build /pubapi/*.go coordinator/pubapi/pubproto/
|
|
|
|
COPY --from=build /vpnapi/*.go coordinator/vpnapi/vpnproto/
|
2022-04-11 08:25:19 -04:00
|
|
|
COPY --from=build /disk-mapper/*.go state/keyservice/keyproto/
|
2022-04-12 08:24:36 -04:00
|
|
|
COPY --from=build /service/*.go debugd/service/
|