-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
132 lines (105 loc) · 4.89 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
.PHONY:
# ==============================================================================
# Docker Control
HUB_NAME = someday94
REPO_PREFIX = goilerplate
DOCKERFILE_DIR_PATH = ./docker
push_api:
@read -p "Enter Version Name:" version; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-api:$$version -f $(DOCKERFILE_DIR_PATH)/api/Dockerfile .; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-api:$$version; \
push_postgres:
@read -p "Enter Version Name:" version; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-postgres:$$version -f $(DOCKERFILE_DIR_PATH)/postgres/Dockerfile .; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-postgres:$$version; \
push_redis:
@read -p "Enter Version Name:" version; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-redis:$$version -f $(DOCKERFILE_DIR_PATH)/redis/Dockerfile .; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-redis:$$version; \
push_pgadmin4:
@read -p "Enter Version Name:" version; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-pgadmin4:$$version -f $(DOCKERFILE_DIR_PATH)/pgadmin4/Dockerfile .; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-pgadmin4:$$version; \
push_all:
@read -p "Enter Version Name:" version; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-api:$$version -f $(DOCKERFILE_DIR_PATH)/api/Dockerfile .; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-postgres:$$version -f $(DOCKERFILE_DIR_PATH)/postgres/Dockerfile .; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-redis:$$version -f $(DOCKERFILE_DIR_PATH)/redis/Dockerfile .; \
docker build -t $(HUB_NAME)/$(REPO_PREFIX)-pgadmin4:$$version -f $(DOCKERFILE_DIR_PATH)/pgadmin4/Dockerfile .; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-api:$$version; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-postgres:$$version; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-redis:$$version; \
docker push $(HUB_NAME)/$(REPO_PREFIX)-pgadmin4:$$version; \
# ==============================================================================
# Kubectl Control
deploy-to-docker-desktop:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
kubectl apply -f k8s/base/metrics-server.yaml
sleep 30
kubectl apply -f k8s/postgres-volume.yaml
kubectl apply -f k8s/postgres-deployment.yaml
kubectl apply -f k8s/postgres-service.yaml
kubectl apply -f k8s/redis-volume.yaml
kubectl apply -f k8s/redis-deployment.yaml
kubectl apply -f k8s/redis-service.yaml
kubectl apply -f k8s/pgAdmin4-deployment.yaml
kubectl apply -f k8s/pgAdmin4-service.yaml
kubectl apply -f k8s/api-deployment.yaml
kubectl apply -f k8s/api-service.yaml
kubectl apply -f k8s/api-hpa.yaml
kubectl apply -f k8s/ingress-internal.yaml
delete-to-docker-desktop:
kubectl delete -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
kubectl delete -f k8s/base/metrics-server.yaml
kubectl delete -f k8s/postgres-volume.yaml
kubectl delete -f k8s/postgres-deployment.yaml
kubectl delete -f k8s/postgres-service.yaml
kubectl delete -f k8s/redis-volume.yaml
kubectl delete -f k8s/redis-deployment.yaml
kubectl delete -f k8s/redis-service.yaml
kubectl delete -f k8s/pgAdmin4-deployment.yaml
kubectl delete -f k8s/pgAdmin4-service.yaml
kubectl delete -f k8s/api-deployment.yaml
kubectl delete -f k8s/api-service.yaml
kubectl delete -f k8s/api-hpa.yaml
kubectl delete -f k8s/ingress-internal.yaml
deploy-to-cloud:
kubectl apply -f k8s/base/kube-flannel.yaml
sleep 30
kubectl apply -f k8s/base/metrics-server.yaml
kubectl apply -f k8s/base/metallb-native.yaml
kubectl apply -f k8s/ipaddress-pools.yaml
kubectl apply -f k8s/base/ingress-nginx.yaml
sleep 30
kubectl apply -f k8s/postgres-volume.yaml
kubectl apply -f k8s/postgres-deployment.yaml
kubectl apply -f k8s/postgres-service.yaml
kubectl apply -f k8s/redis-volume.yaml
kubectl apply -f k8s/redis-deployment.yaml
kubectl apply -f k8s/redis-service.yaml
kubectl apply -f k8s/pgAdmin4-deployment.yaml
kubectl apply -f k8s/pgAdmin4-service.yaml
kubectl apply -f k8s/api-deployment.yaml
kubectl apply -f k8s/api-service.yaml
kubectl apply -f k8s/api-hpa.yaml
kubectl apply -f k8s/secret-tls.yaml
kubectl apply -f k8s/ingress-external.yaml
delete-to-cloud:
kubectl delete -f k8s/base/kube-flannel.yaml
kubectl delete -f k8s/base/metrics-server.yaml
kubectl delete -f k8s/base/metallb-native.yaml
kubectl delete -f k8s/ipaddress-pools.yaml
kubectl delete -f k8s/base/ingress-nginx.yaml
kubectl delete -f k8s/postgres-volume.yaml
kubectl delete -f k8s/postgres-deployment.yaml
kubectl delete -f k8s/postgres-service.yaml
kubectl delete -f k8s/redis-volume.yaml
kubectl delete -f k8s/redis-deployment.yaml
kubectl delete -f k8s/redis-service.yaml
kubectl delete -f k8s/pgAdmin4-deployment.yaml
kubectl delete -f k8s/pgAdmin4-service.yaml
kubectl delete -f k8s/api-deployment.yaml
kubectl delete -f k8s/api-service.yaml
kubectl delete -f k8s/api-hpa.yaml
kubectl delete -f k8s/secret-tls.yaml
kubectl delete -f k8s/ingress-external.yaml