From 57c4354b7bbfaf16d583091aabc6f9cb4f5908e7 Mon Sep 17 00:00:00 2001 From: kahirokunn Date: Thu, 13 Jul 2023 19:58:52 +0900 Subject: [PATCH] chore: support grpc-ping-go multiple architecture Signed-off-by: kahirokunn --- code-samples/serving/grpc-ping-go/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code-samples/serving/grpc-ping-go/Dockerfile b/code-samples/serving/grpc-ping-go/Dockerfile index 9aad9b4c2e6..3fba178798c 100644 --- a/code-samples/serving/grpc-ping-go/Dockerfile +++ b/code-samples/serving/grpc-ping-go/Dockerfile @@ -17,6 +17,9 @@ # https://hub.docker.com/_/golang FROM golang as builder +ARG TARGETOS +ARG TARGETARCH + # Copy local code to the container image. WORKDIR /go/src/github.com/knative/docs/code-samples/serving/grpc-ping-go COPY . ./ @@ -26,8 +29,8 @@ RUN go mod tidy # Build the command inside the container. # To facilitate gRPC testing, this container includes a client command. -RUN CGO_ENABLED=0 go build -tags=grpcping -o ./ping-server -RUN CGO_ENABLED=0 go build -tags=grpcping -o ./ping-client ./client +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -tags=grpcping -o ./ping-server +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -tags=grpcping -o ./ping-client ./client # Use a Docker multi-stage build to create a lean production image. # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds