-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
67 lines (52 loc) · 2.3 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
# Make targets for building the mqtt service for the visual_inferencing edge service
# This imports the variables from horizon/hzn.json. You can ignore these lines, but do not remove them
-include horizon/.hzn.json.tmp.mk
# Default ARCH to the architecture of this machines (as horizon/golang describes it)
export ARCH ?= $(shell hzn architecture)
# Configurable parameters passed to serviceTest.sh in "test" target
export MATCH:='Starting mqtt broker...'
export TIME_OUT:=60
DOCKER_NAME := $(ARCH)_mqtt
# Build the docker image for the current architecture
build:
docker build -t $(DOCKER_IMAGE_BASE)_$(ARCH):$(SERVICE_VERSION) -f ./Dockerfile.$(ARCH) .
# Build the docker image for 3 architectures
build-all-arches:
ARCH=amd64 $(MAKE) build
ARCH=arm $(MAKE) build
ARCH=arm64 $(MAKE) build
# Run the docker image for the current architecture
run:
-docker rm -f $(DOCKER_NAME) 2> /dev/null || :
docker run -e MQTT_USERNAME -e MQTT_PASSWORD -d --name $(DOCKER_NAME) $(DOCKER_IMAGE_BASE)_$(ARCH):$(SERVICE_VERSION)
# Run the docker image for 3 architectures
run-all-arches:
ARCH=amd64 $(MAKE) run
ARCH=arm $(MAKE) run
ARCH=arm64 $(MAKE) run
# Target for travis to publish service and pattern after PR is merged
publish:
ARCH=amd64 $(MAKE) publish-service
ARCH=arm $(MAKE) publish-service
ARCH=arm64 $(MAKE) publish-service
# Publish the service to the Horizon Exchange for the current architecture
publish-service:
hzn exchange service publish -O -f horizon/service.definition.json
# target for script - overwrite and pull insitead of push docker image
publish-service-overwrite:
hzn exchange service publish -O -P -f horizon/service.definition.json
# new target for icp exchange to run on startup to publish only
publish-only:
ARCH=amd64 $(MAKE) publish-service-overwrite
ARCH=arm $(MAKE) publish-service-overwrite
ARCH=arm64 $(MAKE) publish-service-overwrite
clean:
-docker rmi $(DOCKER_IMAGE_BASE)_$(ARCH):$(SERVICE_VERSION) 2> /dev/null || :
clean-all-archs:
ARCH=amd64 $(MAKE) clean
ARCH=arm $(MAKE) clean
ARCH=arm64 $(MAKE) clean
# This imports the variables from horizon/hzn.cfg. You can ignore these lines, but do not remove them.
horizon/.hzn.json.tmp.mk: horizon/hzn.json
@ hzn util configconv -f $< | sed 's/=/?=/' > $@
.PHONY: build build-all-arches publish-service publish-all-arches clean clean-all-archs