Skip to content

Instantly share code, notes, and snippets.

@madchap
Created November 15, 2021 20:28
Show Gist options
  • Save madchap/6a8dfdcc366cf6c1b18a777080b1c52e to your computer and use it in GitHub Desktop.
Save madchap/6a8dfdcc366cf6c1b18a777080b1c52e to your computer and use it in GitHub Desktop.
Hello gRPC server
FROM golang:1.17 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends git; \
rm -rf /var/lib/apt/lists/*
WORKDIR $GOPATH/src/helloworld
RUN git clone -b v1.41.0 https://github.com/grpc/grpc-go
WORKDIR grpc-go/examples/helloworld/greeter_server
RUN go mod init
RUN go get -d -v
RUN CGO_ENABLED=0 go build -o /go/bin/greeter_server
RUN ls -l /go/bin/greeter_server
FROM scratch
COPY --from=builder /go/bin/greeter_server /go/bin/greeter_server
ENTRYPOINT ["/go/bin/greeter_server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment