Makefile 1.03 KB
Newer Older
Adam Harrison's avatar
Adam Harrison committed
1
2
3
4
.DEFAULT: all
.PHONY: all clean image publish-image minikube-publish

DH_ORG=weaveworks
Adam Harrison's avatar
Adam Harrison committed
5
VERSION=$(shell git symbolic-ref --short HEAD)-$(shell git rev-parse --short HEAD)
Adam Harrison's avatar
Adam Harrison committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

all: image

clean:
	go clean
	rm -f cmd/kured/kured
	rm -rf ./build

godeps=$(shell go get $1 && go list -f '{{join .Deps "\n"}}' $1 | grep -v /vendor/ | xargs go list -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}')

DEPS=$(call godeps,./cmd/kured)

cmd/kured/kured: $(DEPS)
cmd/kured/kured: cmd/kured/*.go
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$(VERSION)" -o $@ cmd/kured/*.go

build/.image.done: cmd/kured/Dockerfile cmd/kured/kured
	mkdir -p build
	cp $^ build
Adam Harrison's avatar
Adam Harrison committed
25
	sudo -E docker build -t quay.io/$(DH_ORG)/kured:$(VERSION) -f build/Dockerfile ./build
Adam Harrison's avatar
Adam Harrison committed
26
27
28
29
30
	touch $@

image: build/.image.done

publish-image: image
Adam Harrison's avatar
Adam Harrison committed
31
	sudo -E docker push quay.io/$(DH_ORG)/kured:$(VERSION)
Adam Harrison's avatar
Adam Harrison committed
32
33

minikube-publish: image
Adam Harrison's avatar
Adam Harrison committed
34
	sudo -E docker save quay.io/$(DH_ORG)/kured:$(VERSION) | (eval $$(minikube docker-env) && docker load)