forked from edgexfoundry/edgex-go
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
293 lines (240 loc) · 9.14 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#
# Copyright (c) 2018 Cavium
#
# SPDX-License-Identifier: Apache-2.0
#
.PHONY: build clean test docker run
GO=CGO_ENABLED=0 GO111MODULE=on go
GOCGO=CGO_ENABLED=1 GO111MODULE=on go
DOCKERS=docker_build_base docker_volume docker_config_seed docker_export_client docker_export_distro docker_core_data docker_core_metadata docker_core_command docker_support_logging docker_support_notifications docker_sys_mgmt_agent docker_support_scheduler docker_security_secrets_setup docker_security_proxy_setup docker_security_secretstore_setup
# DOCKERS+=docker_app_service_configurable docker_support_rulesengine
DOCKERS+=docker_consul docker_volume docker_devices docker_ui
.PHONY: $(DOCKERS)
MICROSERVICES=cmd/config-seed/config-seed cmd/export-client/export-client cmd/export-distro/export-distro cmd/core-metadata/core-metadata cmd/core-data/core-data cmd/core-command/core-command cmd/support-logging/support-logging cmd/support-notifications/support-notifications cmd/sys-mgmt-executor/sys-mgmt-executor cmd/sys-mgmt-agent/sys-mgmt-agent cmd/support-scheduler/support-scheduler cmd/security-secrets-setup/security-secrets-setup cmd/security-proxy-setup/security-proxy-setup cmd/security-secretstore-setup/security-secretstore-setup
.PHONY: $(MICROSERVICES)
VERSION=$(shell cat ./VERSION)
DOCKER_TAG=$(shell uname -m)-$(VERSION)
GOFLAGS=-ldflags "-X github.com/objectbox/edgex-objectbox.Version=$(VERSION)"
GIT_SHA=$(shell git rev-parse HEAD)
ARCH=$(shell uname -m)
build: $(MICROSERVICES)
cmd/config-seed/config-seed:
$(GO) build $(GOFLAGS) -o $@ ./cmd/config-seed
cmd/core-metadata/core-metadata:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/core-metadata
cmd/core-data/core-data:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/core-data
cmd/core-command/core-command:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/core-command
cmd/export-client/export-client:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/export-client
cmd/export-distro/export-distro:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/export-distro
cmd/support-logging/support-logging:
$(GO) build $(GOFLAGS) -o $@ ./cmd/support-logging
cmd/support-notifications/support-notifications:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/support-notifications
cmd/sys-mgmt-executor/sys-mgmt-executor:
$(GO) build $(GOFLAGS) -o $@ ./cmd/sys-mgmt-executor
cmd/sys-mgmt-agent/sys-mgmt-agent:
$(GO) build $(GOFLAGS) -o $@ ./cmd/sys-mgmt-agent
cmd/support-scheduler/support-scheduler:
$(GOCGO) build $(GOFLAGS) -o $@ ./cmd/support-scheduler
cmd/security-secrets-setup/security-secrets-setup:
$(GO) build $(GOFLAGS) -o ./cmd/security-secrets-setup/security-secrets-setup ./cmd/security-secrets-setup
cmd/security-proxy-setup/security-proxy-setup:
$(GO) build $(GOFLAGS) -o ./cmd/security-proxy-setup/security-proxy-setup ./cmd/security-proxy-setup
cmd/security-secretstore-setup/security-secretstore-setup:
$(GO) build $(GOFLAGS) -o ./cmd/security-secretstore-setup/security-secretstore-setup ./cmd/security-secretstore-setup
clean:
rm -f $(MICROSERVICES)
test:
GO111MODULE=on go test -coverprofile=coverage.out ./...
GO111MODULE=on go vet ./...
gofmt -l .
[ "`gofmt -l .`" = "" ]
./bin/test-go-mod-tidy.sh
./bin/test-attribution-txt.sh
run:
cd bin && ./edgex-launch.sh
run_docker:
bin/edgex-docker-launch.sh $(EDGEX_DB)
docker: $(DOCKERS)
docker_build_base:
docker build \
-f build/base/Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-build-base:$(GIT_SHA) \
.
# docker_app_service_configurable:
# $(eval NAME := app-service-configurable)
# ./build/get-upstream-repo.sh \
# $(NAME) \
# 407c5695040f00cf2c69603f5ad8d39d9232cb8d \
# https://github.com/edgexfoundry/app-service-configurable.git
# docker build \
# --build-arg http_proxy \
# --build-arg https_proxy \
# --label "git_sha=$(GIT_SHA)" \
# -t objectboxio/edgex-$(NAME):$(GIT_SHA) \
# -t objectboxio/edgex-$(NAME):$(DOCKER_TAG) \
# build/checkouts/$(NAME)
# currently fails to build: Step 7/15 : COPY target/*.jar $APP_DIR/$APP - no source files were specified
# docker_support_rulesengine:
# $(eval NAME := support-rulesengine)
# ./build/get-upstream-repo.sh \
# $(NAME) \
# 35f17d8e59789244a7d634909f958bd3b73e8e81 \
# https://github.com/edgexfoundry/support-rulesengine.git
# docker build \
# --build-arg http_proxy \
# --build-arg https_proxy \
# --label "git_sha=$(GIT_SHA)" \
# -t objectboxio/edgex-$(NAME):$(GIT_SHA) \
# -t objectboxio/edgex-$(NAME):$(DOCKER_TAG) \
# build/checkouts/$(NAME)
docker_consul:
./build/build-upstream-repo.sh \
consul \
50b620a4478e2ed0408c29de667cb3e11d03cd8a \
https://github.com/edgexfoundry/docker-edgex-consul.git \
$(GIT_SHA) \
$(DOCKER_TAG)
docker_volume:
./build/build-upstream-repo.sh \
volume \
9cc8536c83189269461638e6684ed6435b9b3075 \
https://github.com/edgexfoundry/docker-edgex-volume.git \
$(GIT_SHA) \
$(DOCKER_TAG)
docker_devices:
./build/build-upstream-repo.sh \
device-virtual \
fb454a3731a380daa3bfc3bfa45a73d1aa22ed51 \
https://github.com/edgexfoundry/device-virtual-go.git \
$(GIT_SHA) \
$(DOCKER_TAG)
docker_ui:
# fails for ARMv7 because of the repository mirrors that are being added to apk in the upstream Dockerfile
# ./build/build-upstream-repo.sh \
# ui \
# 277361c19809286defc6bccd20bc08e304c6ef7c \
# https://github.com/edgexfoundry/edgex-ui-go.git \
# $(GIT_SHA) \
# $(DOCKER_TAG)
docker build \
-f build/ui-go/Dockerfile \
--build-arg src_git_sha=277361c19809286defc6bccd20bc08e304c6ef7c \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-ui-go:$(GIT_SHA) \
-t objectboxio/edgex-ui-go:$(DOCKER_TAG) \
build/ui-go
docker_config_seed:
docker build \
-f cmd/config-seed/Dockerfile \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-core-config-seed:$(GIT_SHA) \
-t objectboxio/edgex-core-config-seed:$(DOCKER_TAG) \
.
docker_core_metadata:
docker build \
-f cmd/Dockerfile --build-arg service=core-metadata \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-core-metadata:$(GIT_SHA) \
-t objectboxio/edgex-core-metadata:$(DOCKER_TAG) \
.
docker_core_data:
docker build \
-f cmd/Dockerfile --build-arg service=core-data \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-core-data:$(GIT_SHA) \
-t objectboxio/edgex-core-data:$(DOCKER_TAG) \
.
docker_core_command:
docker build \
-f cmd/Dockerfile --build-arg service=core-command \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-core-command:$(GIT_SHA) \
-t objectboxio/edgex-core-command:$(DOCKER_TAG) \
.
docker_export_client:
docker build \
-f cmd/Dockerfile --build-arg service=export-client \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-export-client:$(GIT_SHA) \
-t objectboxio/edgex-export-client:$(DOCKER_TAG) \
.
docker_export_distro:
docker build \
-f cmd/export-distro/Dockerfile \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-export-distro:$(GIT_SHA) \
-t objectboxio/edgex-export-distro:$(DOCKER_TAG) \
.
docker_support_logging:
docker build \
-f cmd/support-logging/Dockerfile \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-support-logging:$(GIT_SHA) \
-t objectboxio/edgex-support-logging:$(DOCKER_TAG) \
.
docker_support_notifications:
docker build \
-f cmd/Dockerfile --build-arg service=support-notifications \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-support-notifications:$(GIT_SHA) \
-t objectboxio/edgex-support-notifications:$(DOCKER_TAG) \
.
docker_support_scheduler:
docker build \
-f cmd/Dockerfile --build-arg service=support-scheduler \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-support-scheduler:$(GIT_SHA) \
-t objectboxio/edgex-support-scheduler:$(DOCKER_TAG) \
.
docker_sys_mgmt_agent:
docker build \
-f cmd/sys-mgmt-agent/Dockerfile \
--build-arg git_sha=$(GIT_SHA) \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-sys-mgmt-agent:$(GIT_SHA) \
-t objectboxio/edgex-sys-mgmt-agent:$(DOCKER_TAG) \
.
docker_security_secrets_setup:
# TODO: split this up and rename it when security-secrets-setup is a
# different container
docker build \
-f cmd/security-secrets-setup/Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-secret-store:$(GIT_SHA) \
-t objectboxio/edgex-secret-store:$(DOCKER_TAG) \
.
docker_security_proxy_setup:
docker build \
-f cmd/security-proxy-setup/Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-security-proxy-setup:$(GIT_SHA) \
-t objectboxio/edgex-security-proxy-setup:$(DOCKER_TAG) \
.
docker_security_secretstore_setup:
docker build \
-f cmd/security-secretstore-setup/Dockerfile \
--label "git_sha=$(GIT_SHA)" \
-t objectboxio/edgex-security-secretstore-setup:$(GIT_SHA) \
-t objectboxio/edgex-security-secretstore-setup:$(DOCKER_TAG) \
.
raml_verify:
docker run --rm --privileged \
-v $(PWD):/raml-verification -w /raml-verification \
nexus3.edgexfoundry.org:10003/edgex-docs-builder:$(ARCH) \
/scripts/raml-verify.sh