forked from kubernetes-retired/cloud-provider-baiducloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (44 loc) · 1.2 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
VERSION ?= $(shell git describe --always --dirty)
GOOS ?= linux
ARCH ?= amd64
REGISTRY := hub.baidubce.com/jpaas-public
BIN := cce-cloud-controller-manager
IMAGE := $(REGISTRY)/$(BIN)
SRC_DIRS := cmd pkg # directories which hold app source (not vendored)
.PHONY: all
all: build
.PHONY: build-output
build-output:
@mkdir -p output/
.PHONY: build
build: build-output
@GOOS=${GOOS} GOARCH=${ARCH} go build \
-i \
-o output/${BIN} \
-installsuffix "static" \
-ldflags "-X main.version=${VERSION}" \
./cmd/cce-cloud-controller-manager
.PHONY: local-build
local-build: build-output
@go build \
-i \
-o output/${BIN} \
-installsuffix "static" \
-ldflags "-X main.version=${VERSION}" \
./cmd/cce-cloud-controller-manager
.PHONY: image-build
image-build: build
docker build -t ${IMAGE}:v1.11-latest .
docker push ${IMAGE}:v1.11-latest
.PHONY: test
test:
@./hack/test.sh $(SRC_DIRS)
.PHONY: clean
clean:
@rm -rf output
.PHONY: deploy
deploy:
kubectl -n kube-system set image deployments/${BIN} ${BIN}=${IMAGE}:${VERSION}
.PHONY: version
version:
@echo ${VERSION}