-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (34 loc) · 1.47 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
SHELL := /bin/bash
NAMESPACE = wordpress-test
WP_OPERATOR_IMAGE_NAME = quay-its.epfl.ch/svc0041/wp-operator
WP_OPERATOR_IMAGE_TAG ?= latest
.PHONY: help
## Print this help
help:
@echo "$$(tput setaf 2)Available rules:$$(tput sgr0)";sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## /---/;td" -e"s/:.*//;G;s/\\n## /===/;s/\\n//g;p;}" ${MAKEFILE_LIST}|awk -F === -v n=$$(tput cols) -v i=4 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"- %s%s%s\n",a,$$1,z;m=split($$2,w,"---");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;}printf"%*s%s\n",-i," ",w[j];}}'
.PHONY: operator
## Launch the WordPress operator (locally)
operator:
python3 wp-operator.py run -n $(NAMESPACE) -- --db-host mariadb-min.$(NAMESPACE).svc
.PHONY: image
## Build, tag and push the image
image: build push
.PHONY: deploy
## Deploy the WordPress operator unsing `operator.yaml`
deploy:
@echo "Deploying$$(grep 'image:' operator-namespaced.yaml | tr -s ' ') ..."
@echo " ... change it in ./operator-namespaced.yaml if needed."
kubectl apply -f operator-namespaced.yaml
.PHONY: delete
## Delete the WordPress operator unsing `operator.yaml`
delete:
kubectl delete -f operator-namespaced.yaml
.PHONY: build
## Build the image as `WP_OPERATOR_IMAGE_NAME`
build:
docker build -t $(WP_OPERATOR_IMAGE_NAME) .
.PHONY: push
## Push the image using `REGISTRY` and `WP_OPERATOR_IMAGE_TAG`
push:
docker push $(WP_OPERATOR_IMAGE_NAME):latest
docker push $(WP_OPERATOR_IMAGE_NAME):$(WP_OPERATOR_IMAGE_TAG)