forked from asobti/kube-monkey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (31 loc) · 1.03 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
all: build
ENVVAR = GOOS=linux GOARCH=amd64 CGO_ENABLED=0
TAG = v0.2.1
.PHONY: all build container clean
build: test clean gofmt
$(ENVVAR) go build -o kube-monkey
# Supressing docker build avoids printing the env variables
container: build
ifneq ($(and $(http_proxy), $(https_proxy)),)
@echo Starting Docker build, importing both http_proxy and https_proxy env variables
@docker build --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) -t kube-monkey:$(TAG) .
else
ifdef http_proxy
@echo Starting Docker build, importing http_proxy
@docker build --build-arg http_proxy=$(http_proxy) -t kube-monkey:$(TAG) .
else
ifdef https_proxy
@echo Starting Docker build, importing https_proxy
@docker build --build-arg https_proxy=$(https_proxy) -t kube-monkey:$(TAG) .
else
@echo no env proxies set, building normally
docker build -t kube-monkey:$(TAG) .
endif
endif
endif
gofmt:
find . -path ./vendor -prune -o -name '*.go' -print | xargs -L 1 -I % gofmt -s -w %
clean:
rm -f kube-monkey
test:
go test -v -cover ./...