Skip to content

Commit

Permalink
pass version string to docker build (#1313)
Browse files Browse the repository at this point in the history
Signed-off-by: Zbynek Roubalik <[email protected]>
  • Loading branch information
zroubalik authored Nov 4, 2020
1 parent 58042db commit 50bec80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.adapter
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50bec80

Please sign in to comment.