forked from open-horizon-services/service-sms-me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (67 loc) · 2.44 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
DOCKERHUB_ID:=ibmosquito
SERVICE_NAME:="sms-me"
SERVICE_VERSION:="1.0.0"
PATTERN_NAME:="pattern-sms-me"
ARCH:="arm"
# Leave blank for open DockerHub containers
# CONTAINER_CREDS:=-r "registry.wherever.com:myid:mypw"
CONTAINER_CREDS:=
# The SMS message will contain the LAN IP address assigned to this interface
INTERFACE_NAME:=eth0
# The SMS message will be sent to the TARGET_SMS_NUMBER stated here
# Start with '+' then country code, then number, e.g.: +15555551212
TARGET_SMS_NUMBER:=
# These are your Synch credentials:
# The SENDER_SMS_NUMBER can be your virtual number or one of your real ones
SERVICE_PLAN_ID:=
API_TOKEN:=
SENDER_SMS_NUMBER:=
default: build run
build:
docker build -t $(DOCKERHUB_ID)/$(NAME)_$(ARCH):$(SERVICE_VERSION) .
dev: stop build
docker run -it -v `pwd`:/outside \
--name ${SERVICE_NAME} \
--net=host \
-e SERVICE_PLAN_ID=$(SERVICE_PLAN_ID) \
-e API_TOKEN=$(API_TOKEN) \
-e SENDER_SMS_NUMBER=$(SENDER_SMS_NUMBER) \
-e INTERFACE_NAME=$(INTERFACE_NAME) \
-e TARGET_SMS_NUMBER=$(TARGET_SMS_NUMBER) \
$(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION) /bin/bash
run: stop
docker run -d \
--name ${SERVICE_NAME} \
--restart unless-stopped \
--net=host \
-e SERVICE_PLAN_ID=$(SERVICE_PLAN_ID) \
-e API_TOKEN=$(API_TOKEN) \
-e SENDER_SMS_NUMBER=$(SENDER_SMS_NUMBER) \
-e INTERFACE_NAME=$(INTERFACE_NAME) \
-e TARGET_SMS_NUMBER=$(TARGET_SMS_NUMBER) \
$(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION)
test:
echo "Check your phone for an SMS!"
push:
docker push $(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION)
publish-service:
@ARCH=$(ARCH) \
SERVICE_NAME="$(SERVICE_NAME)" \
SERVICE_VERSION="$(SERVICE_VERSION)"\
SERVICE_CONTAINER="$(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION)" \
hzn exchange service publish -O $(CONTAINER_CREDS) -f service.json --pull-image
publish-pattern:
@ARCH=$(ARCH) \
SERVICE_NAME="$(SERVICE_NAME)" \
SERVICE_VERSION="$(SERVICE_VERSION)"\
PATTERN_NAME="$(PATTERN_NAME)" \
hzn exchange pattern publish -f pattern.json
stop:
@docker rm -f ${SERVICE_NAME} >/dev/null 2>&1 || :
clean:
@docker rmi -f $(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION) >/dev/null 2>&1 || :
agent-run:
hzn register --pattern "${HZN_ORG_ID}/$(PATTERN_NAME)"
agent-stop:
hzn unregister -f
.PHONY: build dev run push publish-service publish-pattern test stop clean agent-run agent-stop