forked from kubernetes/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (101 loc) · 4.19 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
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
include $(ROOT_DIRECTORY)/hack/include/config.mk
include $(ROOT_DIRECTORY)/hack/include/build.mk
include $(API_DIRECTORY)/hack/include/config.mk
include $(WEB_DIRECTORY)/hack/include/config.mk
MAKEFLAGS += -j2
# List of targets that should be executed before other targets
PRE = --ensure-tools
.PHONY: help
help:
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: check
check: $(PRE) check-license ## Runs all available checks
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=check
.PHONY: fix
fix: $(PRE) fix-license ## Runs all available fix scripts
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=fix
.PHONY: check-license
check-license: $(PRE) ## Checks if repo files contain valid license header
@${GOPATH}/bin/license-eye header check
.PHONY: fix-license
fix-license: $(PRE) ## Adds missing license header to repo files
@${GOPATH}/bin/license-eye header fix
# Starts development version of the application.
#
# URL: http://localhost:8080
#
# Note: Make sure that the port 8080 is free on your localhost
.PHONY: serve
serve: $(PRE) ## Starts development version of the application on: http://localhost:8080
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=serve
# Starts development version of the application with HTTPS enabled.
#
# URL: https://localhost:8080
#
# Note: Make sure that the port 8080 is free on your localhost
# Note #2: Does not work with "kind".
.PHONY: serve-https
serve-https: $(PRE) ## Starts development version of the application with HTTPS enabled on: https://localhost:8080
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=serve-https
# Starts production version of the application.
#
# URL: https://localhost:4443
#
# Note: Make sure that the ports 4443 (Gateway) and 9001 (API) are free on your localhost
# Note #2: Does not work with "kind".
# Note #3: Darwin doesn't work at the moment, so we are using Linux by default.
.PHONY: run
run: $(PRE) --ensure-linux --ensure-compose-down --compose ## Starts production version of the application on https://localhost:4443
@KUBECONFIG=$(KUBECONFIG) \
SYSTEM_BANNER=$(SYSTEM_BANNER) \
SYSTEM_BANNER_SEVERITY=$(SYSTEM_BANNER_SEVERITY) \
ENABLE_SKIP_LOGIN=$(ENABLE_SKIP_LOGIN) \
SIDECAR_HOST=$(SIDECAR_HOST) \
TOKEN_TTL=$(TOKEN_TTL) \
ARCH=$(ARCH) \
OS=$(OS) \
docker compose -f $(DOCKER_COMPOSE_PATH) --project-name=$(PROJECT_NAME) up
.PHONY: build
build: TARGET := build
build: build-cross ## Builds the application for the architecture of the host machine
.PHONY: build-cross
build-cross: ## Builds the application for all supported architectures
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=$(or $(TARGET),build-cross)
.PHONY: deploy
deploy: build-cross ## Builds and deploys all module containers to the configured registries
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=deploy
.PHONY: deploy-dev
deploy-dev: build-cross ## Builds and deploys all module containers to the configured dev registries
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=deploy-dev
.PHONY: --compose
--compose: --ensure-certificates build
@KUBECONFIG=$(KUBECONFIG) \
SYSTEM_BANNER=$(SYSTEM_BANNER) \
SYSTEM_BANNER_SEVERITY=$(SYSTEM_BANNER_SEVERITY) \
ENABLE_SKIP_LOGIN=$(ENABLE_SKIP_LOGIN) \
SIDECAR_HOST=$(SIDECAR_HOST) \
TOKEN_TTL=$(TOKEN_TTL) \
ARCH=$(ARCH) \
OS=$(OS) \
docker compose -f $(DOCKER_COMPOSE_PATH) --project-name=$(PROJECT_NAME) build
.PHONY: --ensure-linux
--ensure-linux:
export OS=linux
.PHONY: --ensure-tools
--ensure-tools:
@$(MAKE) --no-print-directory -C $(TOOLS_DIRECTORY) install
.PHONY: --ensure-compose-down
--ensure-compose-down:
@KUBECONFIG=$(KUBECONFIG) \
SYSTEM_BANNER=$(SYSTEM_BANNER) \
SYSTEM_BANNER_SEVERITY=$(SYSTEM_BANNER_SEVERITY) \
ENABLE_SKIP_LOGIN=$(ENABLE_SKIP_LOGIN) \
SIDECAR_HOST=$(SIDECAR_HOST) \
TOKEN_TTL=$(TOKEN_TTL) \
ARCH=$(ARCH) \
OS=$(OS) \
docker compose -f $(DOCKER_COMPOSE_PATH) --project-name=$(PROJECT_NAME) down
.PHONY: --ensure-certificates
--ensure-certificates:
@$(MAKE) --no-print-directory -C $(GATEWAY_DIRECTORY) generate-certificates