-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (56 loc) · 2.19 KB
/
Copy pathMakefile
File metadata and controls
72 lines (56 loc) · 2.19 KB
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
DOCKER_REGISTRY = index.docker.io
IMAGE_NAME = kunsul
IMAGE_VERSION = latest
IMAGE_ORG = flaccid
IMAGE_TAG = $(DOCKER_REGISTRY)/$(IMAGE_ORG)/$(IMAGE_NAME):$(IMAGE_VERSION)
export DOCKER_BUILDKIT = 1
WORKING_DIR := $(shell pwd)
.DEFAULT_GOAL := docker-build
.PHONY: build push
go-deps:: ## fetch all the go dependencies
go get ./...
docker-release:: docker-build docker-push ## builds and pushes the docker image to the registry
docker-push:: ## pushes the docker image to the registry
@docker push $(IMAGE_TAG)
docker-build:: ## builds the docker image locally
@echo http_proxy=$(HTTP_PROXY) http_proxy=$(HTTPS_PROXY)
@echo building $(IMAGE_TAG)
@docker build --pull \
--build-arg=http_proxy=$(HTTP_PROXY) \
--build-arg=https_proxy=$(HTTPS_PROXY) \
-t $(IMAGE_TAG) $(WORKING_DIR)
docker-run:: ## runs the docker image locally
@docker run \
-it \
$(DOCKER_REGISTRY)/$(IMAGE_ORG)/$(IMAGE_NAME):$(IMAGE_VERSION)
kube-test:: ## runs a temporary pod with port forwarding for exposure
@kubectl delete pod/kunsul --namespace default || true
@kubectl run --generator=run-pod/v1 --image=$(IMAGE_TAG) kunsul \
--port=8080 --namespace default \
--image-pull-policy Never
@sleep 1 \
&& kubectl wait --for=condition=Ready pod/kunsul --namespace default \
&& kubectl port-forward pod/kunsul 8080:8080 --namespace default \
&& kubectl delete pod/kunsul --namespace default || true
helm-install:: ## installs using helm from chart in repo
@helm install --name kunsul ./charts/kunsul
helm-upgrade:: ## upgrades deployed helm release
@helm upgrade kunsul ./charts/kunsul
helm-purge:: ## deletes and purges deployed helm release
@helm delete --purge kunsul
helm-render:: ## prints out the rendered chart
@helm install --dry-run --debug charts/kunsul
helm-validate:: ## runs a lint on the helm chart
@helm lint charts/kunsul
# a help target including self-documenting targets (see the awk statement)
define HELP_TEXT
Usage: make [TARGET]... [MAKEVAR1=SOMETHING]...
Available targets:
endef
export HELP_TEXT
help: ## this help target
@cat .banner
@echo
@echo "$$HELP_TEXT"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)