27 lines
586 B
Docker
27 lines
586 B
Docker
FROM golang:latest AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install protoc
|
|
RUN apt-get update && apt-get install -y protobuf-compiler
|
|
|
|
# Install protoc Go plugins
|
|
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
|
|
|
ENV PATH=$PATH:/root/go/bin
|
|
|
|
COPY go.mod ./
|
|
COPY proto ./proto
|
|
|
|
# Generate proto files
|
|
RUN protoc --go_out=. --go_opt=paths=source_relative \
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
proto/agent.proto
|
|
|
|
RUN go mod tidy
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /app .
|