Skip to content

Commit 160fa57

Browse files
cpuguy83feiskyer
authored andcommitted
Add Makefile target for image
This gives us a build target specifically for building an image with options we need for customizing it.
1 parent 1fbc65c commit 160fa57

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Makefile

+12-1
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,26 @@ TEST_CREDENTIALS_JSON ?= $(TEST_CREDENTIALS_DIR)/credentials.json
88
TEST_LOGANALYTICS_JSON ?= $(TEST_CREDENTIALS_DIR)/loganalytics.json
99
export TEST_CREDENTIALS_JSON TEST_LOGANALYTICS_JSON
1010

11-
DOCKER_IMAGE := virtual-kubelet
11+
IMG_REPO ?= virtual-kubelet
12+
OUTPUT_TYPE ?= docker
13+
BUILDPLATFORM ?= linux/amd64
1214
VERSION := $(shell git describe --tags --always --dirty="-dev")
15+
IMG_TAG ?= $(VERSION)
1316

1417
.PHONY: safebuild
1518
# docker build
1619
safebuild:
1720
@echo "Building image..."
1821
docker build -t $(DOCKER_IMAGE):$(VERSION) .
1922

23+
.PHONY: image
24+
image:
25+
docker buildx build \
26+
--platform="$(BUILDPLATFORM)" \
27+
--tag $(IMG_REPO):$(IMG_TAG) \
28+
--output=type=$(OUTPUT_TYPE) \
29+
.
30+
2031
.PHONY: build
2132
build: bin/virtual-kubelet
2233

0 commit comments

Comments
 (0)