-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
120 lines (76 loc) · 3.29 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
go_version = go1.6.2.linux-amd64
go:
@echo "\033[1mInstall Go compiler\033[0m"
@[ -d env ] || mkdir env
@if [ ! -d env/go ]; then \
cd env && \
wget https://storage.googleapis.com/golang/$(go_version).tar.gz && \
tar -xf ./$(go_version).tar.gz && \
mkdir gopath && \
rm ./$(go_version).tar.gz ; \
fi
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
env/go/bin/go get -u github.com/FiloSottile/gvt
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
env/go/bin/go get -u github.com/kshvakov/build-html
@echo "\033[1mGo compiler installed!\033[0m"
build-worker:
@echo "\033[1mBuild Postgres-CI worker\033[0m"
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
env/go/bin/go get -d -u github.com/postgres-ci/worker
@cd env/gopath/src/github.com/postgres-ci/worker && \
$(shell pwd)/env/gopath/bin/gvt restore
@[ -d worker/tmp/ ] || mkdir worker/tmp/
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
CGO_ENABLED=0 \
env/go/bin/go build -ldflags='-s -w' -o worker/tmp/worker \
env/gopath/src/github.com/postgres-ci/worker/worker.go
@echo "\033[1mBuild worker: done!\033[0m"
build-app-server:
@echo "\033[1mBuild Postgres-CI app-server\033[0m"
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
env/go/bin/go get -d -u github.com/postgres-ci/app-server
@cd env/gopath/src/github.com/postgres-ci/app-server && \
$(shell pwd)/env/gopath/bin/gvt restore
@rm -rf app-server/tmp/ && mkdir -p app-server/tmp/assets
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
CGO_ENABLED=0 \
env/go/bin/go build -ldflags='-s -w' -o app-server/tmp/app-server \
env/gopath/src/github.com/postgres-ci/app-server/app-server.go
@cp -r env/gopath/src/github.com/postgres-ci/app-server/assets/static app-server/tmp/assets/static
@./env/gopath/bin/build-html -i env/gopath/src/github.com/postgres-ci/app-server/assets/templates_src -o app-server/tmp/assets/templates
@echo "\033[1mBuild app-server: done!\033[0m"
build-notifier:
@echo "\033[1mBuild Postgres-CI notifier\033[0m"
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
env/go/bin/go get -d -u github.com/postgres-ci/notifier
@cd env/gopath/src/github.com/postgres-ci/notifier && \
$(shell pwd)/env/gopath/bin/gvt restore
@[ -d notifier/tmp/ ] || mkdir notifier/tmp/
@GOROOT=$(shell pwd)/env/go \
GOPATH=$(shell pwd)/env/gopath \
CGO_ENABLED=0 \
env/go/bin/go build -ldflags='-s -w' -o notifier/tmp/notifier \
env/gopath/src/github.com/postgres-ci/notifier/worker.go
@echo "\033[1mBuild notifier: done!\033[0m"
build-worker-image: build-worker
@echo "\033[1mBuild worker docker image\033[0m"
@cd worker && docker build -t postgresci/worker .
@echo "\033[1mBuild worker docker image: done!\033[0m"
build-app-server-image: build-app-server
@echo "\033[1mBuild app-server docker image\033[0m"
@cd app-server && docker build -t postgresci/app-server .
@echo "\033[1mBuild app-server docker image: done!\033[0m"
build-notifier-image: build-notifier
@echo "\033[1mBuild notifier docker image\033[0m"
@cd notifier && docker build -t postgresci/notifier .
@echo "\033[1mBuild notifier docker image: done!\033[0m"
build: build-worker build-app-server build-notifier
all: go build-worker-image build-app-server-image build-notifier-image