1+ include ../includes.mk
2+
13REPO = deis
24MESOS = 0.22.1-1.0.ubuntu1404
35MESOS_VERSION = v1.9.0
@@ -13,56 +15,108 @@ GOLINT = golint
1315GOTEST = $(GO ) test -cover -race -v
1416GOVET = $(GO ) vet
1517
16- GO_PACKAGES = pkg/boot pkg/confd pkg/etcd pkg/fleet pkg/log pkg/net
18+ COMPONENT = $(notdir $(repo_path ) )
19+ GO_PACKAGES = pkg/boot pkg/confd pkg/etcd pkg/fleet pkg/log pkg/net pkg/os pkg/types
1720GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path ) /,$(GO_PACKAGES ) )
1821
19- build : test-style zookeeper-go build-tools mesos-template mesos-master mesos-slave mesos-marathon zookeeper
22+ MASTER_IMAGE = $(IMAGE_PREFIX ) mesos-master:$(BUILD_TAG )
23+ MASTER_DEV_IMAGE = $(REGISTRY )$(MASTER_IMAGE )
24+ MARATHON_IMAGE = $(IMAGE_PREFIX ) mesos-marathon:$(BUILD_TAG )
25+ MARATHON_DEV_IMAGE = $(REGISTRY )$(MARATHON_IMAGE )
26+ SLAVE_IMAGE = $(IMAGE_PREFIX ) mesos-slave:$(BUILD_TAG )
27+ SLAVE_DEV_IMAGE = $(REGISTRY )$(SLAVE_IMAGE )
28+ ZOOKEEPER_IMAGE = $(IMAGE_PREFIX ) zookeeper:$(BUILD_TAG )
29+ ZOOKEEPER_DEV_IMAGE = $(REGISTRY )$(ZOOKEEPER_IMAGE )
30+
31+ build : test-style zookeeper-go mesos-template mesos-master mesos-slave mesos-marathon zookeeper
32+
33+ install : check-deisctl
34+ deisctl install $(COMPONENT )
35+
36+ uninstall : check-deisctl
37+ deisctl uninstall $(COMPONENT )
38+
39+ start : check-deisctl
40+ deisctl start $(COMPONENT )
41+
42+ stop : check-deisctl
43+ deisctl stop $(COMPONENT )
44+
45+ restart : stop start
46+
47+ run : install start
2048
21- mesos-go :
49+ dev-release : push set-image
50+
51+ push : check-registry
52+ docker tag -f $(MASTER_IMAGE ) $(MASTER_DEV_IMAGE )
53+ docker push $(MASTER_DEV_IMAGE )
54+ docker tag -f $(SLAVE_IMAGE ) $(SLAVE_DEV_IMAGE )
55+ docker push $(SLAVE_DEV_IMAGE )
56+ docker tag -f $(MARATHON_IMAGE ) $(MARATHON_DEV_IMAGE )
57+ docker push $(MARATHON_DEV_IMAGE )
58+ docker tag -f $(ZOOKEEPER_IMAGE ) $(ZOOKEEPER_DEV_IMAGE )
59+ docker push $(ZOOKEEPER_DEV_IMAGE )
60+
61+ set-image : check-deisctl
62+ deisctl config mesos-master set image=$(MASTER_DEV_IMAGE )
63+ deisctl config mesos-slave set image=$(SLAVE_DEV_IMAGE )
64+ deisctl config mesos-marathon set image=$(MARATHON_DEV_IMAGE )
65+ deisctl config zookeeper set image=$(ZOOKEEPER_DEV_IMAGE )
66+
67+ release :
68+ docker push $(MASTER_IMAGE )
69+ docker push $(SLAVE_IMAGE )
70+ docker push $(MARATHON_IMAGE )
71+ docker push $(ZOOKEEPER_IMAGE )
72+
73+ deploy : build dev-release restart
74+
75+ setup-gotools :
76+ go get -u github.com/jteeuwen/go-bindata/...
77+
78+ mesos-go : setup-gotools
2279 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags ' -s' -o bin/master-boot pkg/boot/mesos/master/main.go
2380 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags ' -s' -o bin/slave-boot pkg/boot/mesos/slave/main.go
24- go-bindata -pkg bindata -o pkg/boot/mesos/ marathon/bindata /bindata.go pkg/boot/mesos/marathon/bash/; \
81+ go-bindata -pkg bindata -o bindata/ marathon/bindata.go pkg/boot/mesos/marathon/bash/; \
2582 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags ' -s' -o bin/marathon-boot pkg/boot/mesos/marathon/main.go
2683
2784mesos-template :
2885 sed " s/#VERSION#/$( MESOS) /g" template > Dockerfile
29- docker build -t $(REPO ) / $@ :$(MESOS_VERSION ) .
86+ docker build -t $(IMAGE_PREFIX ) $@ :$(MESOS_VERSION ) .
3087 rm -f Dockerfile
3188
3289mesos-master : mesos-go mesos-template
3390 sed " s/#VERSION#/$( MESOS_VERSION) /g" master > Dockerfile
34- docker build -t $(REPO ) / $@ :$(MESOS_VERSION ) .
91+ docker build -t $(IMAGE_PREFIX ) $@ :$(BUILD_TAG ) .
3592 rm -f Dockerfile
3693
3794mesos-slave : mesos-go mesos-template
3895 sed " s/#VERSION#/$( MESOS_VERSION) /g" slave > Dockerfile
39- docker build -t $(REPO ) / $@ :$(MESOS_VERSION ) .
96+ docker build -t $(IMAGE_PREFIX ) $@ :$(BUILD_TAG ) .
4097 rm -f Dockerfile
4198
4299build-mesos-marathon : mesos-template
43100 sed " s/#MARATHON_VERSION#/$( MARATHON_VERSION) /;s/#VERSION#/$( MESOS_VERSION) /" build-marathon > Dockerfile
44- docker build -t $(REPO ) / $@ :$(MESOS_VERSION ) .
101+ docker build -t $(IMAGE_PREFIX ) $@ :$(BUILD_TAG ) .
45102 rm -f Dockerfile
46103
47- mesos-marathon : build- mesos-marathon mesos-go
104+ mesos-marathon : mesos-go build- mesos-marathon
48105 cp marathon Dockerfile
49- docker cp ` docker create $( REPO ) / build-mesos-marathon:$( MESOS_VERSION ) /bin/bash` :/marathon/target/marathon-assembly-$(MARATHON_VERSION ) .jar .
106+ docker cp ` docker create $( IMAGE_PREFIX ) build-mesos-marathon:$( BUILD_TAG ) /bin/bash` :/marathon/target/marathon-assembly-$(MARATHON_VERSION ) .jar .
50107 mv marathon-assembly-$(MARATHON_VERSION ) .jar marathon-assembly.jar
51108 sed " s/#MARATHON_VERSION#/$( MARATHON_VERSION) /;s/#VERSION#/$( MESOS_VERSION) /" marathon > Dockerfile
52- docker build -t $(REPO ) / $@ :$(MESOS_VERSION ) .
109+ docker build -t $(IMAGE_PREFIX ) $@ :$(BUILD_TAG ) .
53110 rm -f Dockerfile
54111
55112zookeeper : zookeeper-go
56- docker build -t $(REPO ) / $@ :$(ZOOKEEPER_VERSION ) zookeeper/.
113+ docker build -t $(IMAGE_PREFIX ) $@ :$(BUILD_TAG ) zookeeper/.
57114
58115zookeeper-go :
59116 echo " Building..."
60- go-bindata -pkg bindata -o pkg/boot/ zookeeper/bindata /bindata.go pkg/boot/zookeeper/bash/; \
117+ go-bindata -pkg bindata -o bindata/ zookeeper/bindata.go pkg/boot/zookeeper/bash/; \
61118 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags ' -s' -o zookeeper/bin/boot pkg/boot/zookeeper/main/boot.go
62119
63- build-tools :
64- echo " Building tools..."
65-
66120test : mesos-go zookeeper-go
67121 @$(GOFMT ) -timeout 10s $(GO_PACKAGES )
68122
0 commit comments