-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (47 loc) · 1.52 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
.SILENT:
.DEFAULT_GOAL := help
COLOR_RESET = \033[0m
COLOR_COMMAND = \033[36m
COLOR_YELLOW = \033[33m
COLOR_GREEN = \033[32m
COLOR_RED = \033[31m
PROJECT := Flay
## Installs a development environment
install: deploy
## Composes project using docker-compose
deploy:
#docker-compose -f deployments/docker-compose.yml build --no-cache
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml down -v
#docker-compose -f deployments/docker-compose.yml up -d --force-recreate
docker-compose -f docker-compose.yml up
## Build the flask-app image
build:
$(eval $(minikube docker-env))
docker build . -f app/Dockerfile --tag flask-app
## Apply the K8s manifests to your cluster
apply: build
$(eval $(minikube docker-env))
kubectl apply -f k8s/db.yaml
kubectl rollout status statefulset/mongodb-standalone
kubectl apply -f k8s/app.yaml
## Port forward the flast app
serve: apply
kubectl wait --for=condition=available --timeout=600s deployment --all
kubectl port-forward svc/flask-service 5000:80
## Cleanup the deployments
cleanup:
kubectl delete -f k8s/
## Prints help message
help:
printf "\n${COLOR_YELLOW}${PROJECT}\n------\n${COLOR_RESET}"
awk '/^[a-zA-Z\-\_0-9\.%]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "${COLOR_COMMAND}$$ make %s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort
printf "\n"