-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
113 lines (92 loc) · 3.87 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
# A simple NVIDIA Deepstream 5 python example for open-horizon
# An example public RTSP stream you can use for development:
# export RTSPINPUT=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
SERVICE_NAME:="deepstream-open-horizon"
SERVICE_VERSION:="1.1.0"
# Get the Open-Horizon architecture type, and IP address for this host
# If my "helper" program doesn't work for you here, just set them manually!
ARCH:=$(shell ./helper -a)
IPADDR:=$(shell ./helper -i)
# Different base images for the two supported hardware architectures:
BASE_IMAGE.arm64:=nvcr.io/nvidia/deepstream-l4t:5.0-dp-20.04-samples
BASE_IMAGE.amd64:=nvcr.io/nvidia/deepstream:5.0-dp-20.04-triton
run: validate-rtspinput clean
@echo "\n\n"
@echo "*** Using RTSP input URI: $(RTSPINPUT)"
@echo "*** Output stream URI is: rtsp://$(IPADDR):8554/ds"
@echo "\n\n"
# Optional: --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864
docker run -d \
--name ${SERVICE_NAME} \
-e RTSPINPUT=${RTSPINPUT} \
-e ARCH=$(ARCH) \
-e IPADDR=$(IPADDR) \
-p 8554:8554 \
$(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION)
dev: validate-rtspinput clean
# Optional: --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864
docker run -it -v `pwd`:/outside \
--name ${SERVICE_NAME} \
-e RTSPINPUT=${RTSPINPUT} \
-e ARCH=$(ARCH) \
-e IPADDR=$(IPADDR) \
-p 8554:8554 \
$(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION) /bin/bash
build: validate-dockerhubid validate-python-binding
docker build --build-arg BASE_IMAGE=$(BASE_IMAGE.$(ARCH)) -t $(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION) .
push: validate-dockerhubid
docker push $(DOCKERHUB_ID)/$(SERVICE_NAME)_$(ARCH):$(SERVICE_VERSION)
clean: validate-dockerhubid
@docker rm -f ${SERVICE_NAME} >/dev/null 2>&1 || :
#
# Targets to publish service/pattern to an Open-Horizon Exhange, and to register
#
# NOTE: You must install the Open-Horizon CLI in order to use these targets!
#
publish-service: validate-dockerhubid validate-org
ARCH=$(ARCH) \
HZN_ORG_ID="$(HZN_ORG_ID)" \
SERVICE_NAME="$(SERVICE_NAME)" \
SERVICE_VERSION="$(SERVICE_VERSION)"\
DOCKER_IMAGE_BASE="$(DOCKERHUB_ID)/$(SERVICE_NAME)"\
hzn exchange service publish -O -f service.json --pull-image
publish-pattern: validate-org
ARCH=$(ARCH) \
HZN_ORG_ID="$(HZN_ORG_ID)" \
SERVICE_NAME="$(SERVICE_NAME)" \
SERVICE_VERSION="$(SERVICE_VERSION)"\
DOCKER_IMAGE_BASE="$(DOCKERHUB_ID)/$(SERVICE_NAME)"\
hzn exchange pattern publish -f pattern.json
register-pattern: validate-org
ARCH=$(ARCH) \
RTSPINPUT="$(RTSPINPUT)" \
HZN_ORG_ID="$(HZN_ORG_ID)" \
SERVICE_NAME="$(SERVICE_NAME)" \
hzn register --pattern "${HZN_ORG_ID}/pattern-deepstream" --input-file ./input-file.json
#
# Sanity check targets
#
validate-python-binding:
@if [ "" = "$(wildcard deepstream_python_v*.tbz2)" ]; \
then { echo "***** ERROR: First download the Deepstream Python bindings into this directory!"; echo "***** USE this URL: https://developer.nvidia.com/deepstream_python_v0.5"; exit 1; }; \
fi
@sleep 1
validate-rtspinput:
@if [ -z "${RTSPINPUT}" ]; \
then { echo "***** ERROR: \"RTSPINPUT\" is not set!"; exit 1; }; \
else echo " NOTE: Using RTSP input stream: \"${RTSPINPUT}\""; \
fi
@sleep 1
validate-dockerhubid:
@if [ -z "${DOCKERHUB_ID}" ]; \
then { echo "***** ERROR: \"DOCKERHUB_ID\" is not set!"; exit 1; }; \
else echo " NOTE: Using DockerHubID: \"${DOCKERHUB_ID}\""; \
fi
@sleep 1
validate-org:
@if [ -z "${HZN_ORG_ID}" ]; \
then { echo "***** ERROR: \"HZN_ORG_ID\" is not set!"; exit 1; }; \
else echo " NOTE: Using Exchange Org ID: \"${HZN_ORG_ID}\""; \
fi
@sleep 1
.PHONY: build run dev push clean publish-service publish-pattern validate-dockerhubid validate-org