diff --git a/Dockerfile b/Dockerfile index abfd519e857..c1914a89d9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ # Build the manager binary FROM golang:1.15.3 as builder +ARG BUILD_VERSION + WORKDIR /workspace # Copy the Go Modules manifests @@ -24,7 +26,7 @@ COPY pkg/ pkg/ COPY .git/ .git/ # Build -RUN make manager +RUN VERSION=${BUILD_VERSION} make manager # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details diff --git a/Dockerfile.adapter b/Dockerfile.adapter index c47d96c851f..b5de7eea5bf 100644 --- a/Dockerfile.adapter +++ b/Dockerfile.adapter @@ -1,6 +1,8 @@ # Build the manager binary FROM golang:1.15.3 as builder +ARG BUILD_VERSION + WORKDIR /workspace # Copy the Go Modules manifests @@ -26,7 +28,7 @@ COPY .git/ .git/ RUN mkdir -p /apiserver.local.config/certificates && chmod -R 777 /apiserver.local.config # Build -RUN make adapter +RUN VERSION=${BUILD_VERSION} make adapter # 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 6fe5142d8fa..772469a9250 100644 --- a/Makefile +++ b/Makefile @@ -130,9 +130,9 @@ undeploy: build: manifests set-version manager adapter # Build the docker image -docker-build: build - docker build . -t ${IMAGE_CONTROLLER} - docker build -f Dockerfile.adapter -t ${IMAGE_ADAPTER} . +docker-build: + docker build . -t ${IMAGE_CONTROLLER} --build-arg BUILD_VERSION=${VERSION} + docker build -f Dockerfile.adapter -t ${IMAGE_ADAPTER} . --build-arg BUILD_VERSION=${VERSION} # Build KEDA Operator binary .PHONY: manager