...

Text file src/google.golang.org/grpc/interop/xds/client/Dockerfile

Documentation: google.golang.org/grpc/interop/xds/client

     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 client. To build the image, run the
    16# following command from grpc-go directory:
    17# docker build -t <TAG> -f interop/xds/client/Dockerfile .
    18
    19FROM golang:1.21-alpine as build
    20
    21# Make a grpc-go directory and copy the repo into it.
    22WORKDIR /go/src/grpc-go
    23COPY . .
    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 Go compiler and gRPC-Go dependencies.
    27RUN go build -tags osusergo,netgo interop/xds/client/client.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.
    32FROM alpine
    33COPY --from=build /go/src/grpc-go/client .
    34ENV GRPC_GO_LOG_VERBOSITY_LEVEL=99
    35ENV GRPC_GO_LOG_SEVERITY_LEVEL="info"
    36ENV GRPC_GO_LOG_FORMATTER="json"
    37ENTRYPOINT ["./client"]

View as plain text