diff --git a/Dockerfile b/Dockerfile index 60a8f85e..cd48133a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ # Build the manager binary -FROM golang:1.15 as builder +ARG BUILDER_IMAGE_VERSION + +FROM us.icr.io/armada/base/golang-builder:${BUILDER_IMAGE_VERSION} AS builder WORKDIR /workspace # Copy the Go Modules manifests @@ -16,7 +18,7 @@ COPY controllers/ controllers/ COPY internal/ internal/ # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go +RUN GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/Makefile b/Makefile index 3883617b..0f2c89ad 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ IMG ?= cloudoperators/ibmcloud-operator:${RELEASE_VERSION} # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd" +# https://github.ibm.com/alchemy-registry/base/ +BUILDER_IMAGE_VERSION = 1.18.9-20230324 + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -152,7 +155,7 @@ generate: controller-gen .PHONY: docker-build docker-build: - docker build . -t ${IMG} + docker build --build-arg BUILDER_IMAGE_VERSION=${BUILDER_IMAGE_VERSION} . -t ${IMG} .PHONY: docker-push docker-push: docker-build