Skip to content

Commit 4831224

Browse files
authored
replace build with buildx and add more makefile variable (#70)
Signed-off-by: Tal Yichye <tal.yichye@ibm.com>
1 parent 1d12094 commit 4831224

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

Makefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11

22
LINT_VERSION="1.40.0"
33

4-
IMAGE_REPO="quay.io"
5-
NAME_SPACE="ibmodffs"
6-
DRIVER_IMAGE_VERSION=1.4.0
7-
4+
REGISTRY=quay.io/ibmodffs
5+
IMAGE_TAG=1.4.0
6+
PLATFORM=linux/amd64,linux/ppc64le,linux/s390x
87
DRIVER_NAME=ibm-storage-odf-block-driver
98

10-
DRIVER_IMAGE=$(IMAGE_REPO)/${NAME_SPACE}/$(DRIVER_NAME)
9+
DRIVER_IMAGE=$(REGISTRY)/$(DRIVER_NAME):$(IMAGE_TAG)
10+
BUILD_COMMAND = docker buildx build -t $(DRIVER_IMAGE) --platform $(PLATFORM) -f ./Dockerfile .
11+
1112

12-
.PHONY: all $(DRIVER_IMAGE)
13+
.PHONY: all $(DRIVER_NAME)
1314

14-
all: $(DRIVER_IMAGE)
15+
all: $(DRIVER_NAME)
1516

16-
$(DRIVER_IMAGE):
17+
$(DRIVER_NAME):
1718
if [ ! -d ./vendor ]; then dep ensure -v; fi
1819
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -ldflags '-extldflags "-static"' -o ./build/_output/bin/${DRIVER_NAME} ./cmd/manager/main.go
1920

@@ -28,7 +29,7 @@ lint: deps
2829
golangci-lint run -E gosec --timeout=6m # Run `make lint-fix` may help to fix lint issues.
2930

3031
.PHONY: lint-fix
31-
lint-fix: deps
32+
lint-fix: deps
3233
golangci-lint run --fix
3334

3435
.PHONY: build
@@ -38,12 +39,12 @@ build:
3839
.PHONY: test
3940
test:
4041
go test -race -covermode=atomic -coverprofile=cover.out ./pkg/...
41-
42-
build-image:
43-
docker build -t $(DRIVER_IMAGE):$(DRIVER_IMAGE_VERSION) -f ./Dockerfile .
4442

45-
push-image: build-image
46-
docker push $(DRIVER_IMAGE):$(DRIVER_IMAGE_VERSION)
43+
build-image:
44+
$(BUILD_COMMAND)
45+
46+
push-image:
47+
$(BUILD_COMMAND) --push
4748

4849
clean: bin-clean
4950

@@ -54,4 +55,4 @@ add-copyright:
5455
hack/add-copyright.sh
5556

5657
check-copyright:
57-
hack/check-copyright.sh
58+
hack/check-copyright.sh

0 commit comments

Comments
 (0)