From cf5e0305a8bb3ef7bb7418664d334cc4ad5e8dc9 Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Tue, 14 Feb 2023 22:20:27 +0530 Subject: [PATCH 1/5] To support IMAGE changes with ARGS Signed-off-by: Mohit Sharma --- addons/Dockerfile | 3 ++- capabilities/controller/Dockerfile | 3 ++- featuregates/controller/Dockerfile | 3 ++- object-propagation/Dockerfile | 3 ++- pinniped-components/post-deploy/Dockerfile | 3 ++- pinniped-components/tanzu-auth-controller-manager/Dockerfile | 3 ++- pkg/v1/tkr/Dockerfile | 3 ++- tkg/vsphere-template-resolver/Dockerfile | 3 ++- tkr/controller/tkr-source/Dockerfile | 3 ++- tkr/controller/tkr-status/Dockerfile | 3 ++- tkr/webhook/cluster/tkr-resolver/Dockerfile | 3 ++- tkr/webhook/tkr-conversion/Dockerfile | 4 +++- 12 files changed, 25 insertions(+), 12 deletions(-) diff --git a/addons/Dockerfile b/addons/Dockerfile index 2f9dbe7c0d..f288c86a81 100644 --- a/addons/Dockerfile +++ b/addons/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -24,7 +25,7 @@ RUN cd addons && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build - # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/addons/bin/manager . USER nonroot:nonroot diff --git a/capabilities/controller/Dockerfile b/capabilities/controller/Dockerfile index bc26740015..a6946ff2b9 100644 --- a/capabilities/controller/Dockerfile +++ b/capabilities/controller/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -26,7 +27,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o manager mai # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/capabilities/controller/manager . USER nonroot:nonroot diff --git a/featuregates/controller/Dockerfile b/featuregates/controller/Dockerfile index ae4d04dd4d..ecc6feb5c9 100644 --- a/featuregates/controller/Dockerfile +++ b/featuregates/controller/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -35,7 +36,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags "$LD_FLAGS" -o ma # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/featuregates/controller/manager . USER nonroot:nonroot diff --git a/object-propagation/Dockerfile b/object-propagation/Dockerfile index fb52dd0995..96681f009c 100644 --- a/object-propagation/Dockerfile +++ b/object-propagation/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -32,7 +33,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/object-propagation/manager . USER nonroot:nonroot diff --git a/pinniped-components/post-deploy/Dockerfile b/pinniped-components/post-deploy/Dockerfile index 19372f9e2e..29da7b4869 100644 --- a/pinniped-components/post-deploy/Dockerfile +++ b/pinniped-components/post-deploy/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the post-deploy binary FROM $BUILDER_BASE_IMAGE as builder @@ -30,7 +31,7 @@ RUN make native -C post-deploy RUN mkdir -p /tmp/links RUN ln -s /tkg-pinniped-post-deploy-job /tmp/links/tkg-pinniped-post-deploy -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / # Make sure to copy the symlink. COPY --from=builder /tmp/links/ . diff --git a/pinniped-components/tanzu-auth-controller-manager/Dockerfile b/pinniped-components/tanzu-auth-controller-manager/Dockerfile index 7a0541ee91..4582149099 100644 --- a/pinniped-components/tanzu-auth-controller-manager/Dockerfile +++ b/pinniped-components/tanzu-auth-controller-manager/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the tanzu-auth-controller-manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -23,7 +24,7 @@ ARG LD_FLAGS ENV LD_FLAGS="$LD_FLAGS "'-extldflags "-static"' RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$LD_FLAGS" -o tanzu-auth-controller-manager . -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/tanzu-auth-controller-manager . USER nonroot:nonroot diff --git a/pkg/v1/tkr/Dockerfile b/pkg/v1/tkr/Dockerfile index 14bc0db977..ff69de1bdf 100644 --- a/pkg/v1/tkr/Dockerfile +++ b/pkg/v1/tkr/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -32,7 +33,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/pkg/v1/tkr/manager . USER nonroot:nonroot diff --git a/tkg/vsphere-template-resolver/Dockerfile b/tkg/vsphere-template-resolver/Dockerfile index f7752ab1b9..cf465dbb8d 100644 --- a/tkg/vsphere-template-resolver/Dockerfile +++ b/tkg/vsphere-template-resolver/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -40,7 +41,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/tkg/manager . USER nonroot:nonroot diff --git a/tkr/controller/tkr-source/Dockerfile b/tkr/controller/tkr-source/Dockerfile index 5737ee4b95..52d45b26a4 100644 --- a/tkr/controller/tkr-source/Dockerfile +++ b/tkr/controller/tkr-source/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -32,7 +33,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot diff --git a/tkr/controller/tkr-status/Dockerfile b/tkr/controller/tkr-status/Dockerfile index 99b3ff30c2..136563c675 100644 --- a/tkr/controller/tkr-status/Dockerfile +++ b/tkr/controller/tkr-status/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -32,7 +33,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot diff --git a/tkr/webhook/cluster/tkr-resolver/Dockerfile b/tkr/webhook/cluster/tkr-resolver/Dockerfile index d98680b5d1..cbeed0c71d 100644 --- a/tkr/webhook/cluster/tkr-resolver/Dockerfile +++ b/tkr/webhook/cluster/tkr-resolver/Dockerfile @@ -4,6 +4,7 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -32,7 +33,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot diff --git a/tkr/webhook/tkr-conversion/Dockerfile b/tkr/webhook/tkr-conversion/Dockerfile index 679429828f..27880f51f7 100644 --- a/tkr/webhook/tkr-conversion/Dockerfile +++ b/tkr/webhook/tkr-conversion/Dockerfile @@ -4,6 +4,8 @@ # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 +ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot + # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -32,7 +34,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM gcr.io/distroless/static:nonroot +FROM ${DISTROLESS_BASE_IMAGE} WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot From 515ca9e4b7170d61ea18d9b46907216c346f0570 Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Wed, 15 Feb 2023 14:54:40 +0530 Subject: [PATCH 2/5] Adding Make file support for Docker Changes Signed-off-by: Mohit Sharma --- addons/Makefile | 7 ++++++- capabilities/Makefile | 7 ++++++- featuregates/Makefile | 7 ++++++- object-propagation/Makefile | 7 ++++++- pinniped-components/post-deploy/Makefile | 7 ++++++- .../post-deploy/hack/scripts/build-images.sh | 8 ++++++++ .../tanzu-auth-controller-manager/Makefile | 7 ++++++- pkg/v1/tkr/Makefile | 7 ++++++- tkg/vsphere-template-resolver/Makefile | 7 ++++++- tkr/controller/tkr-source/Makefile | 7 ++++++- tkr/controller/tkr-status/Makefile | 7 ++++++- tkr/webhook/cluster/tkr-resolver/Makefile | 7 ++++++- tkr/webhook/tkr-conversion/Makefile | 7 ++++++- 13 files changed, 80 insertions(+), 12 deletions(-) diff --git a/addons/Makefile b/addons/Makefile index c8d49c6a62..5e6b0c1050 100644 --- a/addons/Makefile +++ b/addons/Makefile @@ -17,6 +17,11 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):latest IMG_VERSION_OVERRIDE ?= $(shell git describe --always --dirty --tags) +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + ifeq ($(strip $(OCI_REGISTRY)),) IMG ?= $(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) else @@ -87,7 +92,7 @@ run: fmt vet ## Run locally .PHONY: docker-build docker-build: ## Build the docker image - cd .. && docker build -t $(IMG) -f addons/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd .. && docker build -t $(IMG) -f addons/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-push docker-push: ## Push the docker image diff --git a/capabilities/Makefile b/capabilities/Makefile index dcab9b6078..15b7248cef 100644 --- a/capabilities/Makefile +++ b/capabilities/Makefile @@ -17,6 +17,11 @@ endif CRD_OPTIONS ?= "crd" +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -68,7 +73,7 @@ endif .PHONY: docker-build docker-build: - cd .. && docker build -t $(IMG) -f capabilities/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd .. && docker build -t $(IMG) -f capabilities/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/featuregates/Makefile b/featuregates/Makefile index babc98016f..f7de134aa2 100644 --- a/featuregates/Makefile +++ b/featuregates/Makefile @@ -17,6 +17,11 @@ endif CRD_OPTIONS ?= "crd" +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -34,7 +39,7 @@ run: .PHONY: docker-build docker-build: ## Build docker image - cd ../ && docker build -t $(IMG) -f featuregates/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../ && docker build -t $(IMG) -f featuregates/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/object-propagation/Makefile b/object-propagation/Makefile index 8d83ea0ee2..b6389f6df4 100644 --- a/object-propagation/Makefile +++ b/object-propagation/Makefile @@ -15,6 +15,11 @@ else IMG ?= $(OCI_REGISTRY)/$(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) endif +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -35,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../ && docker build -t $(IMG) -f object-propagation/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../ && docker build -t $(IMG) -f object-propagation/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/pinniped-components/post-deploy/Makefile b/pinniped-components/post-deploy/Makefile index 55b3893b21..a531967102 100644 --- a/pinniped-components/post-deploy/Makefile +++ b/pinniped-components/post-deploy/Makefile @@ -10,6 +10,11 @@ GIT_VERSION ?= $(shell git describe --always --tags) GIT_REF_LONG = $(shell git rev-parse --verify HEAD) # Release version VERSION ?= $(GIT_VERSION) +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + .PHONY: test test: fmt vet ## Run tests @@ -29,7 +34,7 @@ native: ## Build binary .PHONY: build-images build-images: ## Build tkg-pinniped-post-deploy docker images - VERSION=$(VERSION) ./hack/scripts/build-images.sh + VERSION=$(VERSION) DISTROLESS_BASE_IMAGE=$(DISTROLESS_BASE_IMAGE) ./hack/scripts/build-images.sh run: go run ./cmd/job \ diff --git a/pinniped-components/post-deploy/hack/scripts/build-images.sh b/pinniped-components/post-deploy/hack/scripts/build-images.sh index 38806e732a..e75680e6e8 100755 --- a/pinniped-components/post-deploy/hack/scripts/build-images.sh +++ b/pinniped-components/post-deploy/hack/scripts/build-images.sh @@ -20,14 +20,22 @@ FULL_IMAGE_TAR_NAME="${IMAGE_NAME}-${IMAGE_TAG}" # Build from publicly reachable source by default, but allow people to re-build images on # top of their own trusted images. BUILDER_BASE_IMAGE="${BUILDER_BASE_IMAGE:-}" +DISTROLESS_BASE_IMAGE="${DISTROLESS_BASE_IMAGE}" + if [[ -z "${BUILDER_BASE_IMAGE}" ]]; then docker build \ + --build-arg DISTROLESS_BASE_IMAGE="${DISTROLESS_BASE_IMAGE}" \ + -e GOPROXY="${GOPROXY}" \ + -e GOSUMDB="${GOSUMDB}" \ -t "${FULL_IMAGE_NAME}" \ -f "${ROOT_DIR}"/Dockerfile .. else docker build \ --build-arg BUILDER_BASE_IMAGE="${BUILDER_BASE_IMAGE}" \ + --build-arg DISTROLESS_BASE_IMAGE="${DISTROLESS_BASE_IMAGE}" \ + -e GOPROXY="${GOPROXY}" \ + -e GOSUMDB="${GOSUMDB}" \ -t "${FULL_IMAGE_NAME}" \ -f "${ROOT_DIR}"/Dockerfile .. fi diff --git a/pinniped-components/tanzu-auth-controller-manager/Makefile b/pinniped-components/tanzu-auth-controller-manager/Makefile index d9090075f7..9c728a82bc 100644 --- a/pinniped-components/tanzu-auth-controller-manager/Makefile +++ b/pinniped-components/tanzu-auth-controller-manager/Makefile @@ -30,6 +30,11 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):$(IMG_DEFAULT_TAG) IMG_VERSION_OVERRIDE ?= $(IMG_DEFAULT_TAG) +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + ifeq ($(strip $(OCI_REGISTRY)),) IMG ?= $(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) else @@ -38,7 +43,7 @@ endif .PHONY: docker-build docker-build: ## Build docker image - docker build -t $(IMG) -f Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + docker build -t $(IMG) -f Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/pkg/v1/tkr/Makefile b/pkg/v1/tkr/Makefile index ac92ce26c4..b4940ab6be 100644 --- a/pkg/v1/tkr/Makefile +++ b/pkg/v1/tkr/Makefile @@ -6,6 +6,11 @@ include ../../../common.mk IMG ?= tkr-controller-manager:latest CRD_OPTIONS ?= "crd" +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -61,4 +66,4 @@ fakes: ## Generate fake files for go unit tests .PHONY: docker-build docker-build: - cd ../../../ && docker build -t $(IMG) -f pkg/v1/tkr/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../../../ && docker build -t $(IMG) -f pkg/v1/tkr/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . diff --git a/tkg/vsphere-template-resolver/Makefile b/tkg/vsphere-template-resolver/Makefile index 1792d636dd..2735b67666 100644 --- a/tkg/vsphere-template-resolver/Makefile +++ b/tkg/vsphere-template-resolver/Makefile @@ -9,6 +9,11 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):$(IMG_DEFAULT_TAG) IMG_VERSION_OVERRIDE ?= $(IMG_DEFAULT_TAG) +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + ifeq ($(strip $(OCI_REGISTRY)),) IMG ?= $(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) else @@ -35,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../ && docker build -t $(IMG) -f tkg/vsphere-template-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../../ && docker build -t $(IMG) -f tkg/vsphere-template-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/controller/tkr-source/Makefile b/tkr/controller/tkr-source/Makefile index 3337e44ae0..42f99afa33 100644 --- a/tkr/controller/tkr-source/Makefile +++ b/tkr/controller/tkr-source/Makefile @@ -9,6 +9,11 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):$(IMG_DEFAULT_TAG) IMG_VERSION_OVERRIDE ?= $(IMG_DEFAULT_TAG) +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + ifeq ($(strip $(OCI_REGISTRY)),) IMG ?= $(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) else @@ -35,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-source/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-source/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/controller/tkr-status/Makefile b/tkr/controller/tkr-status/Makefile index 2e4d78847e..0686f8988d 100644 --- a/tkr/controller/tkr-status/Makefile +++ b/tkr/controller/tkr-status/Makefile @@ -15,6 +15,11 @@ else IMG ?= $(OCI_REGISTRY)/$(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) endif +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -35,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-status/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-status/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/webhook/cluster/tkr-resolver/Makefile b/tkr/webhook/cluster/tkr-resolver/Makefile index 25e3e03130..d54d0b75aa 100644 --- a/tkr/webhook/cluster/tkr-resolver/Makefile +++ b/tkr/webhook/cluster/tkr-resolver/Makefile @@ -15,6 +15,11 @@ else IMG ?= $(OCI_REGISTRY)/$(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) endif +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -35,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../../ && docker build -t $(IMG) -f tkr/webhook/cluster/tkr-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../../../../ && docker build -t $(IMG) -f tkr/webhook/cluster/tkr-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/webhook/tkr-conversion/Makefile b/tkr/webhook/tkr-conversion/Makefile index 945a497b16..86dabc519b 100644 --- a/tkr/webhook/tkr-conversion/Makefile +++ b/tkr/webhook/tkr-conversion/Makefile @@ -15,6 +15,11 @@ else IMG ?= $(OCI_REGISTRY)/$(IMG_DEFAULT_NAME):$(IMG_VERSION_OVERRIDE) endif +#Adding Support for GOPROXY and GOSUMDB +GOPROXY ?= direct +GOSUMDB ?= off +DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot + all: manager # Run tests @@ -35,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../ && docker build -t $(IMG) -f tkr/webhook/tkr-conversion/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" . + cd ../../../ && docker build -t $(IMG) -f tkr/webhook/tkr-conversion/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image From 53274407eac2203056f3b2c7aacec383ca27d57e Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Thu, 16 Feb 2023 14:55:49 +0530 Subject: [PATCH 3/5] Updating -e flag to buildargs --- addons/Dockerfile | 10 ++++++++-- addons/Makefile | 2 +- capabilities/Makefile | 2 +- capabilities/controller/Dockerfile | 4 ++++ featuregates/Makefile | 2 +- featuregates/controller/Dockerfile | 5 +++++ object-propagation/Dockerfile | 4 ++++ object-propagation/Makefile | 2 +- pinniped-components/post-deploy/Dockerfile | 5 ++++- .../post-deploy/hack/scripts/build-images.sh | 8 ++++---- .../tanzu-auth-controller-manager/Dockerfile | 4 ++++ .../tanzu-auth-controller-manager/Makefile | 2 +- pkg/v1/tkr/Dockerfile | 4 ++++ pkg/v1/tkr/Makefile | 2 +- tkg/vsphere-template-resolver/Dockerfile | 4 ++++ tkg/vsphere-template-resolver/Makefile | 2 +- tkr/controller/tkr-source/Dockerfile | 6 ++++++ tkr/controller/tkr-source/Makefile | 2 +- tkr/controller/tkr-status/Dockerfile | 4 ++++ tkr/controller/tkr-status/Makefile | 2 +- tkr/webhook/cluster/tkr-resolver/Dockerfile | 4 ++++ tkr/webhook/cluster/tkr-resolver/Makefile | 2 +- tkr/webhook/tkr-conversion/Dockerfile | 4 ++++ tkr/webhook/tkr-conversion/Makefile | 2 +- 24 files changed, 70 insertions(+), 18 deletions(-) diff --git a/addons/Dockerfile b/addons/Dockerfile index f288c86a81..407a53768c 100644 --- a/addons/Dockerfile +++ b/addons/Dockerfile @@ -5,7 +5,8 @@ # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot - +ARG GOSUMDB +ARG GOPROXY # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -13,9 +14,14 @@ WORKDIR /workspace # Copy the go source COPY ./ ./ - +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # Build diff --git a/addons/Makefile b/addons/Makefile index 5e6b0c1050..8520725aab 100644 --- a/addons/Makefile +++ b/addons/Makefile @@ -92,7 +92,7 @@ run: fmt vet ## Run locally .PHONY: docker-build docker-build: ## Build the docker image - cd .. && docker build -t $(IMG) -f addons/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd .. && docker build -t $(IMG) -f addons/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-push docker-push: ## Push the docker image diff --git a/capabilities/Makefile b/capabilities/Makefile index 15b7248cef..97d6fbf445 100644 --- a/capabilities/Makefile +++ b/capabilities/Makefile @@ -73,7 +73,7 @@ endif .PHONY: docker-build docker-build: - cd .. && docker build -t $(IMG) -f capabilities/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd .. && docker build -t $(IMG) -f capabilities/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/capabilities/controller/Dockerfile b/capabilities/controller/Dockerfile index a6946ff2b9..0af1afa89e 100644 --- a/capabilities/controller/Dockerfile +++ b/capabilities/controller/Dockerfile @@ -18,6 +18,10 @@ COPY apis/ apis/ COPY cli/runtime cli/runtime WORKDIR capabilities/controller +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # Build diff --git a/featuregates/Makefile b/featuregates/Makefile index f7de134aa2..6827dd8a25 100644 --- a/featuregates/Makefile +++ b/featuregates/Makefile @@ -39,7 +39,7 @@ run: .PHONY: docker-build docker-build: ## Build docker image - cd ../ && docker build -t $(IMG) -f featuregates/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../ && docker build -t $(IMG) -f featuregates/controller/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/featuregates/controller/Dockerfile b/featuregates/controller/Dockerfile index ecc6feb5c9..34af21961f 100644 --- a/featuregates/controller/Dockerfile +++ b/featuregates/controller/Dockerfile @@ -20,6 +20,11 @@ COPY cli/runtime cli/runtime COPY capabilities/client capabilities/client WORKDIR featuregates/controller +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY + RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/object-propagation/Dockerfile b/object-propagation/Dockerfile index 96681f009c..6025419e01 100644 --- a/object-propagation/Dockerfile +++ b/object-propagation/Dockerfile @@ -19,6 +19,10 @@ COPY object-propagation/go.mod object-propagation/go.mod COPY object-propagation/go.sum object-propagation/go.sum WORKDIR /workspace/object-propagation +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/object-propagation/Makefile b/object-propagation/Makefile index b6389f6df4..7467f768e2 100644 --- a/object-propagation/Makefile +++ b/object-propagation/Makefile @@ -40,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../ && docker build -t $(IMG) -f object-propagation/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../ && docker build -t $(IMG) -f object-propagation/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/pinniped-components/post-deploy/Dockerfile b/pinniped-components/post-deploy/Dockerfile index 29da7b4869..a47ecc5141 100644 --- a/pinniped-components/post-deploy/Dockerfile +++ b/pinniped-components/post-deploy/Dockerfile @@ -22,7 +22,10 @@ COPY post-deploy/cmd/ post-deploy/cmd/ COPY post-deploy/pkg/ post-deploy/pkg/ COPY post-deploy/Makefile post-deploy/Makefile #COPY .git/ .git/ - +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN make native -C post-deploy # Support older deployment YAMLs by providing symlink for the historic job name without -job. diff --git a/pinniped-components/post-deploy/hack/scripts/build-images.sh b/pinniped-components/post-deploy/hack/scripts/build-images.sh index e75680e6e8..d260f0c69b 100755 --- a/pinniped-components/post-deploy/hack/scripts/build-images.sh +++ b/pinniped-components/post-deploy/hack/scripts/build-images.sh @@ -26,16 +26,16 @@ if [[ -z "${BUILDER_BASE_IMAGE}" ]]; then docker build \ --build-arg DISTROLESS_BASE_IMAGE="${DISTROLESS_BASE_IMAGE}" \ - -e GOPROXY="${GOPROXY}" \ - -e GOSUMDB="${GOSUMDB}" \ + --build-arg GOPROXY="${GOPROXY}" \ + --build-arg GOSUMDB="${GOSUMDB}" \ -t "${FULL_IMAGE_NAME}" \ -f "${ROOT_DIR}"/Dockerfile .. else docker build \ --build-arg BUILDER_BASE_IMAGE="${BUILDER_BASE_IMAGE}" \ --build-arg DISTROLESS_BASE_IMAGE="${DISTROLESS_BASE_IMAGE}" \ - -e GOPROXY="${GOPROXY}" \ - -e GOSUMDB="${GOSUMDB}" \ + --build-arg GOPROXY="${GOPROXY}" \ + --build-arg GOSUMDB="${GOSUMDB}" \ -t "${FULL_IMAGE_NAME}" \ -f "${ROOT_DIR}"/Dockerfile .. fi diff --git a/pinniped-components/tanzu-auth-controller-manager/Dockerfile b/pinniped-components/tanzu-auth-controller-manager/Dockerfile index 4582149099..b440dd706e 100644 --- a/pinniped-components/tanzu-auth-controller-manager/Dockerfile +++ b/pinniped-components/tanzu-auth-controller-manager/Dockerfile @@ -13,6 +13,10 @@ WORKDIR /workspace # Copy the Go Modules manifests COPY go.mod go.mod COPY go.sum go.sum +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # Copy the source diff --git a/pinniped-components/tanzu-auth-controller-manager/Makefile b/pinniped-components/tanzu-auth-controller-manager/Makefile index 9c728a82bc..ed7ebd6498 100644 --- a/pinniped-components/tanzu-auth-controller-manager/Makefile +++ b/pinniped-components/tanzu-auth-controller-manager/Makefile @@ -43,7 +43,7 @@ endif .PHONY: docker-build docker-build: ## Build docker image - docker build -t $(IMG) -f Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + docker build -t $(IMG) -f Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/pkg/v1/tkr/Dockerfile b/pkg/v1/tkr/Dockerfile index ff69de1bdf..860b61613c 100644 --- a/pkg/v1/tkr/Dockerfile +++ b/pkg/v1/tkr/Dockerfile @@ -19,6 +19,10 @@ COPY pkg/v1/tkr/go.mod pkg/v1/tkr/go.mod COPY pkg/v1/tkr/go.sum pkg/v1/tkr/go.sum WORKDIR /workspace/pkg/v1/tkr +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/pkg/v1/tkr/Makefile b/pkg/v1/tkr/Makefile index b4940ab6be..26ea1de01d 100644 --- a/pkg/v1/tkr/Makefile +++ b/pkg/v1/tkr/Makefile @@ -66,4 +66,4 @@ fakes: ## Generate fake files for go unit tests .PHONY: docker-build docker-build: - cd ../../../ && docker build -t $(IMG) -f pkg/v1/tkr/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../../../ && docker build -t $(IMG) -f pkg/v1/tkr/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . diff --git a/tkg/vsphere-template-resolver/Dockerfile b/tkg/vsphere-template-resolver/Dockerfile index cf465dbb8d..b1f9de5c54 100644 --- a/tkg/vsphere-template-resolver/Dockerfile +++ b/tkg/vsphere-template-resolver/Dockerfile @@ -27,6 +27,10 @@ COPY tkg/go.mod tkg/go.mod COPY tkg/go.sum tkg/go.sum WORKDIR /workspace/tkg +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/tkg/vsphere-template-resolver/Makefile b/tkg/vsphere-template-resolver/Makefile index 2735b67666..5ee724f65c 100644 --- a/tkg/vsphere-template-resolver/Makefile +++ b/tkg/vsphere-template-resolver/Makefile @@ -40,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../ && docker build -t $(IMG) -f tkg/vsphere-template-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../../ && docker build -t $(IMG) -f tkg/vsphere-template-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/controller/tkr-source/Dockerfile b/tkr/controller/tkr-source/Dockerfile index 52d45b26a4..15996a5bad 100644 --- a/tkr/controller/tkr-source/Dockerfile +++ b/tkr/controller/tkr-source/Dockerfile @@ -19,6 +19,12 @@ COPY tkr/go.mod tkr/go.mod COPY tkr/go.sum tkr/go.sum WORKDIR /workspace/tkr + +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY + RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/tkr/controller/tkr-source/Makefile b/tkr/controller/tkr-source/Makefile index 42f99afa33..881e2d41b6 100644 --- a/tkr/controller/tkr-source/Makefile +++ b/tkr/controller/tkr-source/Makefile @@ -40,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-source/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-source/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/controller/tkr-status/Dockerfile b/tkr/controller/tkr-status/Dockerfile index 136563c675..088a602822 100644 --- a/tkr/controller/tkr-status/Dockerfile +++ b/tkr/controller/tkr-status/Dockerfile @@ -19,6 +19,10 @@ COPY tkr/go.mod tkr/go.mod COPY tkr/go.sum tkr/go.sum WORKDIR /workspace/tkr +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/tkr/controller/tkr-status/Makefile b/tkr/controller/tkr-status/Makefile index 0686f8988d..d826363dae 100644 --- a/tkr/controller/tkr-status/Makefile +++ b/tkr/controller/tkr-status/Makefile @@ -40,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-status/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../../../ && docker build -t $(IMG) -f tkr/controller/tkr-status/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/webhook/cluster/tkr-resolver/Dockerfile b/tkr/webhook/cluster/tkr-resolver/Dockerfile index cbeed0c71d..34566a02be 100644 --- a/tkr/webhook/cluster/tkr-resolver/Dockerfile +++ b/tkr/webhook/cluster/tkr-resolver/Dockerfile @@ -19,6 +19,10 @@ COPY tkr/go.mod tkr/go.mod COPY tkr/go.sum tkr/go.sum WORKDIR /workspace/tkr +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/tkr/webhook/cluster/tkr-resolver/Makefile b/tkr/webhook/cluster/tkr-resolver/Makefile index d54d0b75aa..5c2eb06b3d 100644 --- a/tkr/webhook/cluster/tkr-resolver/Makefile +++ b/tkr/webhook/cluster/tkr-resolver/Makefile @@ -40,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../../ && docker build -t $(IMG) -f tkr/webhook/cluster/tkr-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../../../../ && docker build -t $(IMG) -f tkr/webhook/cluster/tkr-resolver/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image diff --git a/tkr/webhook/tkr-conversion/Dockerfile b/tkr/webhook/tkr-conversion/Dockerfile index 27880f51f7..366474b361 100644 --- a/tkr/webhook/tkr-conversion/Dockerfile +++ b/tkr/webhook/tkr-conversion/Dockerfile @@ -20,6 +20,10 @@ COPY tkr/go.mod tkr/go.mod COPY tkr/go.sum tkr/go.sum WORKDIR /workspace/tkr +ARG GOSUMDB +ARG GOPROXY +ENV GOSUMDB=$GOSUMDB +ENV GOPROXY=$GOPROXY RUN go mod download # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer diff --git a/tkr/webhook/tkr-conversion/Makefile b/tkr/webhook/tkr-conversion/Makefile index 86dabc519b..2d686544b0 100644 --- a/tkr/webhook/tkr-conversion/Makefile +++ b/tkr/webhook/tkr-conversion/Makefile @@ -40,7 +40,7 @@ vet: .PHONY: docker-build docker-build: ## Build docker image - cd ../../../ && docker build -t $(IMG) -f tkr/webhook/tkr-conversion/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" -e GOPROXY="$(GOPROXY)" -e GOSUMDB="$(GOSUMDB)" . + cd ../../../ && docker build -t $(IMG) -f tkr/webhook/tkr-conversion/Dockerfile --build-arg LD_FLAGS="$(LD_FLAGS)" --build-arg DISTROLESS_BASE_IMAGE="$(DISTROLESS_BASE_IMAGE)" --build-arg GOPROXY="$(GOPROXY)" --build-arg GOSUMDB="$(GOSUMDB)" . .PHONY: docker-publish docker-publish: ## Publish docker image From c3d90be335a4ec07559eb56d3ae49ca34232dd58 Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Tue, 21 Feb 2023 15:47:31 +0530 Subject: [PATCH 4/5] Update goproxy --- addons/Makefile | 2 +- capabilities/Makefile | 2 +- featuregates/Makefile | 2 +- object-propagation/Makefile | 2 +- pinniped-components/post-deploy/Makefile | 2 +- pinniped-components/tanzu-auth-controller-manager/Makefile | 2 +- pkg/v1/tkr/Makefile | 2 +- tkg/vsphere-template-resolver/Makefile | 2 +- tkr/controller/tkr-source/Makefile | 2 +- tkr/controller/tkr-status/Makefile | 2 +- tkr/webhook/cluster/tkr-resolver/Makefile | 2 +- tkr/webhook/tkr-conversion/Makefile | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/Makefile b/addons/Makefile index 8520725aab..2e039f6044 100644 --- a/addons/Makefile +++ b/addons/Makefile @@ -18,7 +18,7 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):latest IMG_VERSION_OVERRIDE ?= $(shell git describe --always --dirty --tags) #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/capabilities/Makefile b/capabilities/Makefile index 97d6fbf445..43708b6f98 100644 --- a/capabilities/Makefile +++ b/capabilities/Makefile @@ -18,7 +18,7 @@ endif CRD_OPTIONS ?= "crd" #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/featuregates/Makefile b/featuregates/Makefile index 6827dd8a25..0650af2c3f 100644 --- a/featuregates/Makefile +++ b/featuregates/Makefile @@ -18,7 +18,7 @@ endif CRD_OPTIONS ?= "crd" #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/object-propagation/Makefile b/object-propagation/Makefile index 7467f768e2..7999a705fd 100644 --- a/object-propagation/Makefile +++ b/object-propagation/Makefile @@ -16,7 +16,7 @@ else endif #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/pinniped-components/post-deploy/Makefile b/pinniped-components/post-deploy/Makefile index a531967102..718adaa6a1 100644 --- a/pinniped-components/post-deploy/Makefile +++ b/pinniped-components/post-deploy/Makefile @@ -11,7 +11,7 @@ GIT_REF_LONG = $(shell git rev-parse --verify HEAD) # Release version VERSION ?= $(GIT_VERSION) #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/pinniped-components/tanzu-auth-controller-manager/Makefile b/pinniped-components/tanzu-auth-controller-manager/Makefile index ed7ebd6498..5c8a3bb1c3 100644 --- a/pinniped-components/tanzu-auth-controller-manager/Makefile +++ b/pinniped-components/tanzu-auth-controller-manager/Makefile @@ -31,7 +31,7 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):$(IMG_DEFAULT_TAG) IMG_VERSION_OVERRIDE ?= $(IMG_DEFAULT_TAG) #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/pkg/v1/tkr/Makefile b/pkg/v1/tkr/Makefile index 26ea1de01d..f976903797 100644 --- a/pkg/v1/tkr/Makefile +++ b/pkg/v1/tkr/Makefile @@ -7,7 +7,7 @@ IMG ?= tkr-controller-manager:latest CRD_OPTIONS ?= "crd" #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/tkg/vsphere-template-resolver/Makefile b/tkg/vsphere-template-resolver/Makefile index 5ee724f65c..7b733ef358 100644 --- a/tkg/vsphere-template-resolver/Makefile +++ b/tkg/vsphere-template-resolver/Makefile @@ -10,7 +10,7 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):$(IMG_DEFAULT_TAG) IMG_VERSION_OVERRIDE ?= $(IMG_DEFAULT_TAG) #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/tkr/controller/tkr-source/Makefile b/tkr/controller/tkr-source/Makefile index 881e2d41b6..abe8fcadbe 100644 --- a/tkr/controller/tkr-source/Makefile +++ b/tkr/controller/tkr-source/Makefile @@ -10,7 +10,7 @@ IMG_DEFAULT_NAME_TAG := $(IMG_DEFAULT_NAME):$(IMG_DEFAULT_TAG) IMG_VERSION_OVERRIDE ?= $(IMG_DEFAULT_TAG) #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/tkr/controller/tkr-status/Makefile b/tkr/controller/tkr-status/Makefile index d826363dae..7831739ca3 100644 --- a/tkr/controller/tkr-status/Makefile +++ b/tkr/controller/tkr-status/Makefile @@ -16,7 +16,7 @@ else endif #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/tkr/webhook/cluster/tkr-resolver/Makefile b/tkr/webhook/cluster/tkr-resolver/Makefile index 5c2eb06b3d..428b48ca99 100644 --- a/tkr/webhook/cluster/tkr-resolver/Makefile +++ b/tkr/webhook/cluster/tkr-resolver/Makefile @@ -16,7 +16,7 @@ else endif #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/tkr/webhook/tkr-conversion/Makefile b/tkr/webhook/tkr-conversion/Makefile index 2d686544b0..5f32da94bc 100644 --- a/tkr/webhook/tkr-conversion/Makefile +++ b/tkr/webhook/tkr-conversion/Makefile @@ -16,7 +16,7 @@ else endif #Adding Support for GOPROXY and GOSUMDB -GOPROXY ?= direct +GOPROXY ?= "https://proxy.golang.org,direct" GOSUMDB ?= off DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot From ae612fbaf0a292086796d0b3a7b63ebc1741de8c Mon Sep 17 00:00:00 2001 From: Mohit Sharma Date: Thu, 23 Feb 2023 13:15:19 +0530 Subject: [PATCH 5/5] Fixing issue with args and standardize args input for image --- addons/Dockerfile | 6 +----- capabilities/controller/Dockerfile | 2 +- featuregates/controller/Dockerfile | 2 +- object-propagation/Dockerfile | 2 +- pinniped-components/post-deploy/Dockerfile | 2 +- .../tanzu-auth-controller-manager/Dockerfile | 2 +- pkg/v1/tkr/Dockerfile | 2 +- tkg/vsphere-template-resolver/Dockerfile | 2 +- tkr/controller/tkr-source/Dockerfile | 2 +- tkr/controller/tkr-status/Dockerfile | 2 +- tkr/webhook/cluster/tkr-resolver/Dockerfile | 2 +- tkr/webhook/tkr-conversion/Dockerfile | 2 +- 12 files changed, 12 insertions(+), 16 deletions(-) diff --git a/addons/Dockerfile b/addons/Dockerfile index 407a53768c..781a018a58 100644 --- a/addons/Dockerfile +++ b/addons/Dockerfile @@ -5,8 +5,6 @@ # top of their own trusted images. ARG BUILDER_BASE_IMAGE=golang:1.18 ARG DISTROLESS_BASE_IMAGE=gcr.io/distroless/static:nonroot -ARG GOSUMDB -ARG GOPROXY # Build the manager binary FROM $BUILDER_BASE_IMAGE as builder @@ -14,8 +12,6 @@ WORKDIR /workspace # Copy the go source COPY ./ ./ -ENV GOSUMDB=$GOSUMDB -ENV GOPROXY=$GOPROXY # cache deps before building and copying source so that we don't need to re-download as much # and so that source changes don't invalidate our downloaded layer ARG GOSUMDB @@ -31,7 +27,7 @@ RUN cd addons && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build - # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/addons/bin/manager . USER nonroot:nonroot diff --git a/capabilities/controller/Dockerfile b/capabilities/controller/Dockerfile index 0af1afa89e..42977ca225 100644 --- a/capabilities/controller/Dockerfile +++ b/capabilities/controller/Dockerfile @@ -31,7 +31,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o manager mai # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/capabilities/controller/manager . USER nonroot:nonroot diff --git a/featuregates/controller/Dockerfile b/featuregates/controller/Dockerfile index 34af21961f..170c8609c3 100644 --- a/featuregates/controller/Dockerfile +++ b/featuregates/controller/Dockerfile @@ -41,7 +41,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags "$LD_FLAGS" -o ma # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/featuregates/controller/manager . USER nonroot:nonroot diff --git a/object-propagation/Dockerfile b/object-propagation/Dockerfile index 6025419e01..58570c492c 100644 --- a/object-propagation/Dockerfile +++ b/object-propagation/Dockerfile @@ -37,7 +37,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/object-propagation/manager . USER nonroot:nonroot diff --git a/pinniped-components/post-deploy/Dockerfile b/pinniped-components/post-deploy/Dockerfile index a47ecc5141..a9bdcb8afb 100644 --- a/pinniped-components/post-deploy/Dockerfile +++ b/pinniped-components/post-deploy/Dockerfile @@ -34,7 +34,7 @@ RUN make native -C post-deploy RUN mkdir -p /tmp/links RUN ln -s /tkg-pinniped-post-deploy-job /tmp/links/tkg-pinniped-post-deploy -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / # Make sure to copy the symlink. COPY --from=builder /tmp/links/ . diff --git a/pinniped-components/tanzu-auth-controller-manager/Dockerfile b/pinniped-components/tanzu-auth-controller-manager/Dockerfile index b440dd706e..02784aac9c 100644 --- a/pinniped-components/tanzu-auth-controller-manager/Dockerfile +++ b/pinniped-components/tanzu-auth-controller-manager/Dockerfile @@ -28,7 +28,7 @@ ARG LD_FLAGS ENV LD_FLAGS="$LD_FLAGS "'-extldflags "-static"' RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$LD_FLAGS" -o tanzu-auth-controller-manager . -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/tanzu-auth-controller-manager . USER nonroot:nonroot diff --git a/pkg/v1/tkr/Dockerfile b/pkg/v1/tkr/Dockerfile index 860b61613c..d67e1d73d9 100644 --- a/pkg/v1/tkr/Dockerfile +++ b/pkg/v1/tkr/Dockerfile @@ -37,7 +37,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/pkg/v1/tkr/manager . USER nonroot:nonroot diff --git a/tkg/vsphere-template-resolver/Dockerfile b/tkg/vsphere-template-resolver/Dockerfile index b1f9de5c54..56b3c57a5d 100644 --- a/tkg/vsphere-template-resolver/Dockerfile +++ b/tkg/vsphere-template-resolver/Dockerfile @@ -45,7 +45,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/tkg/manager . USER nonroot:nonroot diff --git a/tkr/controller/tkr-source/Dockerfile b/tkr/controller/tkr-source/Dockerfile index 15996a5bad..96d9d98e0e 100644 --- a/tkr/controller/tkr-source/Dockerfile +++ b/tkr/controller/tkr-source/Dockerfile @@ -39,7 +39,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot diff --git a/tkr/controller/tkr-status/Dockerfile b/tkr/controller/tkr-status/Dockerfile index 088a602822..66ed74c8fe 100644 --- a/tkr/controller/tkr-status/Dockerfile +++ b/tkr/controller/tkr-status/Dockerfile @@ -37,7 +37,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot diff --git a/tkr/webhook/cluster/tkr-resolver/Dockerfile b/tkr/webhook/cluster/tkr-resolver/Dockerfile index 34566a02be..aedaa70b50 100644 --- a/tkr/webhook/cluster/tkr-resolver/Dockerfile +++ b/tkr/webhook/cluster/tkr-resolver/Dockerfile @@ -37,7 +37,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot diff --git a/tkr/webhook/tkr-conversion/Dockerfile b/tkr/webhook/tkr-conversion/Dockerfile index 366474b361..d3757ff3b7 100644 --- a/tkr/webhook/tkr-conversion/Dockerfile +++ b/tkr/webhook/tkr-conversion/Dockerfile @@ -38,7 +38,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -ldflags "$ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details -FROM ${DISTROLESS_BASE_IMAGE} +FROM $DISTROLESS_BASE_IMAGE WORKDIR / COPY --from=builder /workspace/tkr/manager . USER nonroot:nonroot