-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
47 lines (36 loc) · 1.04 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
CGO_ENABLED=0
GOARCH=amd64
BINARY=k8snetlook
TAG=v0.3
UNAME_S := $(shell uname -s)
ifeq (${UNAME_S},Linux)
GOOS=linux
endif
ifeq (${UNAME_S},Darwin)
GOOS=darwin
endif
PWD=$(shell pwd)
BUILD_DIR=${PWD}/bin
.PHONY: all k8snetlook-linux clean k8snetlook-osx vet test release docker-image
all: k8snetlook-linux
k8snetlook-linux:
mkdir -p ${BUILD_DIR}
go mod tidy
CGO_ENABLED=${CGO_ENABLED} GOARCH=${GOARCH} GOOS=linux go build -ldflags="-s -w" -o ${BUILD_DIR}/${BINARY} ${PWD}/cmd/k8snetlook
k8snetlook-osx:
mkdir -p ${BUILD_DIR}
go mod tidy
CGO_ENABLED=${CGO_ENABLED} GOARCH=${GOARCH} GOOS=darwin go build -ldflags="-s -w" -o ${BUILD_DIR}/${BINARY}-osx ${PWD}/cmd/k8snetlook
vet:
go mod tidy
CGO_ENABLED=${CGO_ENABLED} GOARCH=${GOARCH} GOOS=${GOOS} go vet ./...
test:
go mod tidy
sudo CGO_ENABLED=${CGO_ENABLED} GOARCH=${GOARCH} GOOS=${GOOS} go test -v ./...
clean:
rm -rf ${BUILD_DIR}
release: k8snetlook-linux
cd ${BUILD_DIR} && \
upx ${BINARY}
docker-image: release
docker build --network host -t sarun87/k8snetlook:${TAG} .