sigs.k8s.io/gateway-api@v1.0.0/docker/Dockerfile.webhook (about)

     1  # Copyright 2021 The Kubernetes 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  ARG BUILDPLATFORM=linux/amd64
    16  FROM --platform=$BUILDPLATFORM golang:1.21.3 AS build-env
    17  RUN mkdir -p /go/src/sig.k8s.io/gateway-api
    18  WORKDIR /go/src/sig.k8s.io/gateway-api
    19  COPY  . .
    20  ARG TARGETARCH
    21  ARG TAG
    22  ARG COMMIT
    23  RUN CGO_ENABLED=0 GOARCH=$TARGETARCH GOOS=linux go build -a -o gateway-api-webhook \
    24        -ldflags "-s -w -X main.VERSION=$TAG -X main.COMMIT=$COMMIT" ./cmd/admission
    25  
    26  FROM gcr.io/distroless/static:nonroot
    27  WORKDIR /
    28  COPY --from=build-env /go/src/sig.k8s.io/gateway-api/gateway-api-webhook .
    29  # Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
    30  USER 65532
    31  ENTRYPOINT ["/gateway-api-webhook"]