forked from edgexfoundry/edgex-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (74 loc) · 3.12 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
# /*******************************************************************************
# * Copyright 2021 Intel
# *
# * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# * in compliance with the License. You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software distributed under the License
# * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# * or implied. See the License for the specific language governing permissions and limitations under
# * the License.
# *
# *******************************************************************************/
.PHONY: help portainer portainer-down pull run pull-ui run-ui down-ui down clean get-token openziti openziti-down zero-trust
.SILENT: help get-token
help:
echo "See README.md in this folder"
ARGS:=$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(ARGS):;@:)
OPTIONS:=" arm64 no-secty app-sample zero-trust " # Must have spaces around words for `filter-out` function to work properly
# This tool now only supports compose V2, aka "docker compose" as it has replaced to old docker-compose tool.
DOCKER_COMPOSE=docker compose
# Resolve user ID for rootless docker port mapping
export USERID:=$(shell id -u)
# Set default rootful docker socket path otherwise detect rootless path
export DOCKER_SOCKET_PATH=/var/run/docker.sock
ifneq (,$(wildcard /run/user/$(USERID)/docker.sock))
export DOCKER_SOCKET_PATH := /run/user/$(USERID)/docker.sock
endif
ifeq (arm64, $(filter arm64,$(ARGS)))
ARM64=-arm64
ARM64_OPTION=arm64
endif
ifeq (no-secty, $(filter no-secty,$(ARGS)))
NO_SECURITY:=-no-secty
endif
ifeq (app-sample, $(filter app-sample,$(ARGS)))
APP_SAMPLE:=-with-app-sample
endif
ifeq (zero-trust, $(filter zero-trust,$(ARGS)))
ZERO_TRUST_OPTION=-zero-trust
endif
SERVICES:=$(filter-out $(OPTIONS),$(ARGS))
define COMPOSE_DOWN
${DOCKER_COMPOSE} -p edgex -f docker-compose-with-app-sample.yml down $1
endef
# Define additional phony targets for all options to enable support for tab-completion in shell
# Note: This must be defined after the options are parsed otherwise it will interfere with them
.PHONY: $(OPTIONS)
portainer:
${DOCKER_COMPOSE} -p portainer -f docker-compose-portainer.yml up -d
portainer-down:
${DOCKER_COMPOSE} -p portainer -f docker-compose-portainer.yml down
openziti:
${DOCKER_COMPOSE} -p edgex -f docker-compose-openziti.yml up -d --build
openziti-down:
${DOCKER_COMPOSE} -p edgex -f docker-compose-openziti.yml down
openziti-logs:
${DOCKER_COMPOSE} -p edgex -f docker-compose-openziti.yml logs -f
openziti-clean:
${DOCKER_COMPOSE} -p edgex -f docker-compose-openziti.yml down -v
pull:
${DOCKER_COMPOSE} -f docker-compose${NO_SECURITY}${ZERO_TRUST_OPTION}${ARM64}.yml pull ${SERVICES}
run:
${DOCKER_COMPOSE} -p edgex -f docker-compose${NO_SECURITY}${APP_SAMPLE}${ZERO_TRUST_OPTION}${ARM64}.yml up -d ${SERVICES}
down:
$(COMPOSE_DOWN)
clean:
$(call COMPOSE_DOWN,-v)
get-token:
DEV=$(DEV) \
ARCH=$(ARCH) \
cd ./compose-builder; sh get-api-gateway-token.sh