...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/build/builder/Dockerfile

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/build/builder

     1# Copyright 2022 Google LLC
     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# This Dockerfile builds an image containing builds of all the binaries built
    16# from source (manager, webhook, etc.)
    17FROM golang:1.19 AS builder
    18
    19# Copy in the Go source code
    20WORKDIR /go/src/github.com/GoogleCloudPlatform/k8s-config-connector
    21COPY pkg/    pkg/
    22COPY cmd/    cmd/
    23COPY config/ config/
    24COPY mockgcp/ mockgcp/
    25COPY third_party/ third_party/
    26COPY scripts/generate-third-party-licenses scripts/generate-third-party-licenses
    27COPY scripts/resource-autogen scripts/resource-autogen
    28COPY go.mod go.mod
    29COPY go.sum go.sum
    30
    31# Build the binaries from source. Note: the "-s -w" flags strip the tables
    32# needed for debuggers, but not the line numbers for panics
    33RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o deletiondefender github.com/GoogleCloudPlatform/k8s-config-connector/cmd/deletiondefender
    34RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o webhook github.com/GoogleCloudPlatform/k8s-config-connector/cmd/webhook
    35RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o recorder github.com/GoogleCloudPlatform/k8s-config-connector/cmd/recorder
    36RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o unmanageddetector github.com/GoogleCloudPlatform/k8s-config-connector/cmd/unmanageddetector
    37RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o manager github.com/GoogleCloudPlatform/k8s-config-connector/cmd/manager
    38
    39RUN go mod vendor -o temp-vendor # So we can load license files
    40RUN go run scripts/generate-third-party-licenses/main.go
    41RUN rm -rf temp-vendor

View as plain text