forked from Seagate/seagate-exos-x-csi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (65 loc) · 2.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.PHONY: help all bin controller node test image limage ubi push clean
ifdef DOCKER_HUB_REPOSITORY
DOCKER_HUB_REPOSITORY := $(DOCKER_HUB_REPOSITORY)
else
DOCKER_HUB_REPOSITORY := ghcr.io/seagate
endif
ifdef VERSION
VERSION := $(VERSION)
else
VERSION := v0.6.0
endif
VERSION_FLAG = -X github.com/Seagate/seagate-exos-x-csi/pkg/common.Version=$(VERSION)
ifndef BIN
BIN = seagate-exos-x-csi
endif
IMAGE = $(DOCKER_HUB_REPOSITORY)/$(BIN):$(VERSION)
help:
@echo ""
@echo "Build Targets:"
@echo "-----------------------------------------------------------------------------------"
@echo "make clean - remove '$(BIN)-controller' and '$(BIN)-node'"
@echo "make all - clean, create driver images, create ubi docker image, push to registry"
@echo "make bin - create controller and node driver images"
@echo "make controller - create controller driver image ($(BIN)-controller)"
@echo "make node - create node driver image ($(BIN)-node)"
@echo "make test - build test/sanity"
@echo "make image - create a repo docker image ($(IMAGE))"
@echo "make limage - create a local docker image ($(IMAGE))"
@echo "make ubi - create a local docker image using Redhat UBI ($(IMAGE))"
@echo "make push - push the docker image to '$(DOCKER_HUB_REPOSITORY)'"
@echo ""
all: clean bin ubi push
bin: controller node
controller:
@echo ""
@echo "[] controller"
go build -v -ldflags "$(VERSION_FLAG)" -o $(BIN)-controller ./cmd/controller
node:
@echo ""
@echo "[] node"
go build -v -ldflags "$(VERSION_FLAG)" -o $(BIN)-node ./cmd/node
test:
@echo ""
@echo "[] test"
./test/sanity
image:
@echo ""
@echo "[] image"
docker build -t $(IMAGE) --build-arg version="$(VERSION)" --build-arg vcs_ref="$(shell git rev-parse HEAD)" --build-arg build_date="$(shell date --rfc-3339=seconds)" .
limage:
@echo ""
@echo "[] limage"
docker build -f Dockerfile.local -t $(IMAGE) --build-arg version="$(VERSION)" --build-arg vcs_ref="$(shell git rev-parse HEAD)" --build-arg build_date="$(shell date --rfc-3339=seconds)" .
ubi:
@echo ""
@echo "[] ubi"
docker build -f Dockerfile.ubi -t $(IMAGE) --build-arg version="$(VERSION)" --build-arg vcs_ref="$(shell git rev-parse HEAD)" --build-arg build_date="$(shell date --rfc-3339=seconds)" .
push:
@echo ""
@echo "[] push"
docker push $(IMAGE)
clean:
@echo ""
@echo "[] clean"
rm -vf $(BIN)-controller $(BIN)-node