-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (67 loc) · 2.92 KB
/
Makefile
File metadata and controls
82 lines (67 loc) · 2.92 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
REPONAME = data-analyses-scheduler
DOCKERIMAGENAME = benchflow/$(REPONAME)
VERSION = dev
GOPATH_SAVE_RESTORE:=$(shell pwd):${GOPATH}
.PHONY: all build_release install_release
all: build_release install_release
save_dependencies:
# TODO: figure out how to get the following work, currently we add the dependencies to the Godeps.json manually
# - refer to the following issue: https://github.com/benchflow/benchflow/issues/33
# cd src/cloud/benchflow/$(REPONAME)/ && \
# GOPATH=$(GOPATH_SAVE_RESTORE) godep save ./... && \
# rm -rf ../../../../Godeps/*.* && \
# rm -rf ../../../../Godeps && \
# mv Godeps/ ../../../.. && \
# cd ../../../..
restore_dependencies:
# TODO: make it working with all the folders
rm -rf Godeps/_workspace/src/golang.org/*
rm -rf Godeps/_workspace/src/github.com/*
rm -rf Godeps/_workspace/src/gopkg.in/*
GOPATH=$(GOPATH_SAVE_RESTORE) godep restore ./...
# TODO: make it working with all but cloud folder
# TODO. NOTE: github.com/wvanbergen/kafka and its dependecies not automatically downloaded with Godeps because of the github.com/wvanbergen/kafka repository structure
# For the same reason, the error is ignored (- at the beginning of the command)
-GOPATH=$(GOPATH_SAVE_RESTORE) go get github.com/wvanbergen/kafka
mv src/golang.org/* Godeps/_workspace/src/golang.org
mv src/github.com/* Godeps/_workspace/src/github.com
mv src/gopkg.in/* Godeps/_workspace/src/gopkg.in
rm -rf src/golang.org
rm -rf src/github.com
rm -rf src/gopkg.in
# TODO: figure out how to get vendor dependencies committed with the standard git flow
# - refer to the following issue: https://github.com/benchflow/benchflow/issues/33
prepare_to_commit:
cd Godeps && \
find . | grep .git/ | xargs rm -rf && \
git add --all -f .
clean:
GOPATH=$(GOPATH_SAVE_RESTORE) go clean -i ./...
rm -rf Godeps/_workspace/pkg
build:
GOPATH=$(GOPATH_SAVE_RESTORE) godep go build -v ./...
build_release:
GOPATH=$(GOPATH_SAVE_RESTORE) GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -ldflags '-s' -v ./...
install:
GOPATH=$(GOPATH_SAVE_RESTORE) godep go install -v ./...
install_release:
GOPATH=$(GOPATH_SAVE_RESTORE) godep go install -v ./...
test:
GOPATH=$(GOPATH_SAVE_RESTORE) godep go test ./...
build_container:
docker build -t $(DOCKERIMAGENAME):$(VERSION) -f Dockerfile .
build_container_local: build_release install_release
GOPATH=$(GOPATH_SAVE_RESTORE) GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -ldflags '-s' -v ./...
docker build -t $(DOCKERIMAGENAME):$(VERSION) -f Dockerfile.test .
test_container_local:
docker run -d -p 8080:8080 \
-e "ENVCONSUL_CONSUL=$(ENVCONSUL_CONSUL_IP):$(ENVCONSUL_CONSUL_PORT)" \
-e "KAFKA_HOST=zookeeper" \
-e "KAFKA_PORT=2181" \
-e "SPARK_MASTER=local[*]" \
-e "CASSANDRA_IP=$(CASSANDRA_IP)" \
-e "MINIO_IP=$(MINIO_IP)" \
--link kafkadocker_zookeeper_1:zookeeper --link kafkadocker_kafka_1:kafka \
--name $(REPONAME) $(DOCKERIMAGENAME):$(VERSION)
rm_container_local:
docker rm -f -v $(REPONAME)