forked from box/kube-iptables-tailer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
30 lines (21 loc) · 807 Bytes
/
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
all: build
ENVVAR = GOOS=linux
TAG = v0.1.0
APP_NAME = kube-iptables-tailer
clean:
rm -f $(APP_NAME)
fmt:
find . -path ./vendor -prune -o -name '*.go' -print | xargs -L 1 -I % gofmt -s -w %
build-cgo: clean fmt
$(ENVVAR) GOARCH=$(GOARCH) GOOS=linux CGO_ENABLED=1 go build -mod vendor -o $(APP_NAME)
build: clean fmt
$(ENVVAR) GOARCH=$(GOARCH) GOOS=linux CGO_ENABLED=0 go build -mod vendor -o $(APP_NAME)
test-unit: clean deps fmt build
CGO_ENABLED=0 go test -v -cover ./...
# Make the container using docker multi-stage build process
# So you don't necessarily have to install golang to make the container
container:
docker build -f Dockerfile -t $(APP_NAME):$(TAG) .
container-cgo:
docker build -f Dockerfile-cgo -t $(APP_NAME):$(TAG) .
.PHONY: all clean deps fmt build test-unit container