@@ -2,7 +2,7 @@ GO ?= go
22GOLANGCILINT ?= golangci-lint
33
44BINARY := oauth2-proxy
5−VERSION := $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
5+VERSION ?= $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
66# Allow to override image registry.
77REGISTRY ?= quay.io/oauth2-proxy
88.NOTPARALLEL:
@@ -13,6 +13,8 @@ MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
1313MINIMUM_SUPPORTED_GO_MINOR_VERSION = 14
1414GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION)
1515
16+DOCKER_BUILD := docker build --build-arg VERSION=${VERSION}
17+
1618ifeq ($(COVER),true)
1719TESTCOVER ?= -coverprofile c.out
1820endif
@@ -41,17 +43,17 @@ $(BINARY):
4143
4244.PHONY: docker
4345docker:
44− docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest .
46+ $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest .
4547
4648.PHONY: docker-all
4749docker-all: docker
48− docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
49− docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} .
50− docker build -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
51− docker build -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
52− docker build -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
53− docker build -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
54− docker build -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
50+ $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:latest-amd64 .
51+ $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION} .
52+ $(DOCKER_BUILD) -f Dockerfile -t $(REGISTRY)/oauth2-proxy:${VERSION}-amd64 .
53+ $(DOCKER_BUILD) -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:latest-arm64 .
54+ $(DOCKER_BUILD) -f Dockerfile.arm64 -t $(REGISTRY)/oauth2-proxy:${VERSION}-arm64 .
55+ $(DOCKER_BUILD) -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:latest-armv6 .
56+ $(DOCKER_BUILD) -f Dockerfile.armv6 -t $(REGISTRY)/oauth2-proxy:${VERSION}-armv6 .
5557
5658.PHONY: docker-push
5759docker-push: