-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (32 loc) · 1.18 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
NAMESPACE=""
REGISTRY="ghcr.io/ironpeakservices/iron-chart-hugo"
NAME="iron-chart-hugo"
STAGE="dev"
RELEASE="$(STAGE)"
K8S_DIR="kubernetes"
DOCKER_DIR=$(K8S_DIR)/docker
CHART_DIR=$(K8S_DIR)/helm
all: build up logs
clean:
helm uninstall --namespace $(NAMESPACE) $(NAME) || true
build:
@if [[ $(STAGE) == "prd" && $(RELEASE) == "prd" ]]; then echo "You must specify a release for production builds."; exit 1; fi;
DOCKER_BUILDKIT=1 docker build -t $(REGISTRY)/$(NAME):$(RELEASE) -f $(DOCKER_DIR)/$(STAGE).Dockerfile .
up:
kubectl create namespace $(NAMESPACE) || true
helm upgrade \
--debug --wait --install \
--namespace $(NAMESPACE) \
--values $(K8S_DIR)/$(STAGE).yaml \
--set "devWorkingDirectory=$(shell pwd)" \
--set "image.tag=$(RELEASE)" \
--version "$(RELEASE)" \
$(NAME) $(CHART_DIR)
helm test --logs --namespace $(NAMESPACE) $(NAME)
kubectl get pods --namespace $(NAMESPACE)
logs:
kubectl logs --namespace $(NAMESPACE) -f -l app=$(NAME)
open:
open "http://127.0.0.1:$$(kubectl get service -n $(NAMESPACE) | grep $(NAME) | grep -Eo '\d+\:\d+' | cut -d ':' -f 1)/"
getimages:
@docker images --no-trunc "$(REGISTRY)/$(NAME)" | grep -v '^REPOSITORY' | awk '{print $$1":"$$2}'