gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/grpc/interop/xds/server/Dockerfile (about) 1 # Copyright 2021 gRPC authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # Dockerfile for building the xDS interop server. To build the image, run the 16 # following command from grpc-go directory: 17 # docker build -t <TAG> -f interop/xds/server/Dockerfile . 18 19 FROM golang:1.16-alpine as build 20 21 # Make a grpc-go directory and copy the repo into it. 22 WORKDIR /go/src/grpc-go 23 COPY . . 24 25 # Build a static binary without cgo so that we can copy just the binary in the 26 # final image, and can get rid of the Go compiler and gRPC-Go dependencies. 27 RUN go build -tags osusergo,netgo interop/xds/server/server.go 28 29 # Second stage of the build which copies over only the client binary and skips 30 # the Go compiler and gRPC repo from the earlier stage. This significantly 31 # reduces the docker image size. 32 FROM alpine 33 COPY --from=build /go/src/grpc-go/server . 34 ENV GRPC_GO_LOG_VERBOSITY_LEVEL=2 35 ENV GRPC_GO_LOG_SEVERITY_LEVEL="info" 36 ENV GRPC_GO_LOG_FORMATTER="json" 37 ENTRYPOINT ["./server"]