Skip to content

Commit 50bec80

Browse files
authored
pass version string to docker build (#1313)
Signed-off-by: Zbynek Roubalik <[email protected]>
1 parent 58042db commit 50bec80

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Build the manager binary
22
FROM golang:1.15.3 as builder
33

4+
ARG BUILD_VERSION
5+
46
WORKDIR /workspace
57

68
# Copy the Go Modules manifests
@@ -24,7 +26,7 @@ COPY pkg/ pkg/
2426
COPY .git/ .git/
2527

2628
# Build
27-
RUN make manager
29+
RUN VERSION=${BUILD_VERSION} make manager
2830

2931
# Use distroless as minimal base image to package the manager binary
3032
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Dockerfile.adapter

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Build the manager binary
22
FROM golang:1.15.3 as builder
33

4+
ARG BUILD_VERSION
5+
46
WORKDIR /workspace
57

68
# Copy the Go Modules manifests
@@ -26,7 +28,7 @@ COPY .git/ .git/
2628
RUN mkdir -p /apiserver.local.config/certificates && chmod -R 777 /apiserver.local.config
2729

2830
# Build
29-
RUN make adapter
31+
RUN VERSION=${BUILD_VERSION} make adapter
3032

3133
# Use distroless as minimal base image to package the manager binary
3234
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ undeploy:
130130
build: manifests set-version manager adapter
131131

132132
# Build the docker image
133-
docker-build: build
134-
docker build . -t ${IMAGE_CONTROLLER}
135-
docker build -f Dockerfile.adapter -t ${IMAGE_ADAPTER} .
133+
docker-build:
134+
docker build . -t ${IMAGE_CONTROLLER} --build-arg BUILD_VERSION=${VERSION}
135+
docker build -f Dockerfile.adapter -t ${IMAGE_ADAPTER} . --build-arg BUILD_VERSION=${VERSION}
136136

137137
# Build KEDA Operator binary
138138
.PHONY: manager

0 commit comments

Comments
 (0)