-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
47 lines (33 loc) · 921 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
APP = heimdall
ARCH = amd64
BIN = bin/$(APP)
BIN_LINUX = $(BIN)-linux-$(ARCH)
BIN_DARWIN = $(BIN)-darwin-$(ARCH)
IMAGE = localhost/$(APP)
CMD_SRC = cmd/$(APP)/main.go
SOURCES = $(shell find . -type f -iname "*.go")
.PHONY: all build vet fmt test run image clean
all: test build
$(BIN_DARWIN): $(SOURCES)
GOARCH=$(ARCH) GOOS=darwin go build -o $(BIN_DARWIN) $(CMD_SRC)
$(BIN_LINUX): $(SOURCES)
GOARCH=$(ARCH) GOOS=linux CGO_ENABLED=0 go build -o $(BIN_LINUX) $(CMD_SRC)
build: $(BIN_DARWIN) $(BIN_LINUX) fmt vet
vet:
go vet ./...
fmt:
go fmt ./...
test: fmt vet
go test ./... -coverprofile cover.out
run: fmt vet
go run $(CMD_SRC) \
--debug \
--kubeconfig ~/.kube/config \
--contexts blue.kube.usw.co,red.kube.usw.co \
--templates kube/config/templates
image: Dockerfile $(BIN_LINUX)
docker image build -t $(IMAGE) .
run-image: image
docker run --rm -ti $(IMAGE)
clean:
rm -rf bin/