-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
162 lines (129 loc) · 3.79 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
.PHONY: build run
# Default values for variables
REPO_S1 ?= localhost:5000/ic2_s1
TAG_S1 ?= latest
IMAGE_S1 ?= ic2_s1
REPO_S3 ?= localhost:5000/ic2_docter
TAG_S3 ?= latest
IMAGE_S3 ?= ic2_S3
REPO_AUTH ?= localhost:5000/ic2_auth
TAG_AUTH ?= latest
IMAGE_AUTH ?= ic2_auth
REPO_DOCTOR ?= localhost:5000/ic2_docter
TAG_DOCTOR ?= latest
IMAGE_DOCTOR ?= ic2_docter
REPO_W1 ?= localhost:5000/ic2_portal
IMAGE_W1 ?= ic2_portal
TAG_W1 ?= latest
build_doctor:
docker build -t $(REPO_DOCTOR):$(TAG_DOCTOR) ../doctor
docker push $(REPO_DOCTOR):$(TAG_DOCTOR)
build_auth:
docker build -t $(REPO_AUTH):$(TAG_AUTH) ../server_auth
docker push $(REPO_AUTH):$(TAG_AUTH)
build_W1:
docker build -t $(REPO_W1):$(TAG_W1) ../portal_version
docker push $(REPO_W1):$(TAG_W1)
build_S1:
docker build -t $(REPO_S1):$(TAG_S1) ../server_request_handler
docker push $(REPO_S1):$(TAG_S1)
build_S3:
docker build -t $(REPO_S3):$(TAG_S3) ../server_service_deployer
docker push $(REPO_S3):$(TAG_S3)
run: run_proxy run_sql run_myadmin run_doctor run_auth run_S1 run_W1 run_S3
run_S1:
docker run --privileged --rm \
-p 3001:3001 \
--net IC2 --ip 172.18.0.7 \
--add-host=host.docker.internal:host-gateway \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--name $(IMAGE_S1) \
$(REPO_S1):$(TAG_S1)
run_S2:
npm ./server_service_creator/ start
run_S3:
docker run --privileged --rm -d \
-p 3003:3003 \
--net IC2 --ip 172.18.0.9 \
--add-host=host.docker.internal:host-gateway \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--name $(IMAGE_S3) \
$(REPO_S3):$(TAG_S3)
run_proxy:
docker run --privileged --rm -d \
-p 3010:8080 -p 3011:8081 \
-v $(PWD)/test_network/ssl:/home/ssl \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--net IC2 --ip 172.18.0.10 \
--add-host=host.docker.internal:host-gateway \
--name proxy \
localhost:5000/proxy:latest
run_sql:
docker run --privileged --rm -d \
-p 3306:3306 -p 33060:33060 \
-v /home/prince/db:/var/lib/mysql \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--net IC2 --ip 172.18.0.2 \
-e PASSWORD="" \
--add-host=host.docker.internal:host-gateway \
--name db \
localhost:5000/mysql:latest
run_myadmin:
docker run --privileged --rm -d \
-p 8080:80 \
--net IC2 --ip 172.18.0.3 \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--add-host=host.docker.internal:host-gateway \
--name phpadmin \
--link db:db \
phpmyadmin:latest
run_doctor:
docker run --privileged --rm \
-p 3004:3004 \
--net IC2 --ip 172.18.0.4 \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--add-host=host.docker.internal:host-gateway \
--name doctor \
localhost:5000/ic2_docter:latest
run_auth:
docker run --privileged --rm -d \
-p 3005:3005 \
--net IC2 --ip 172.18.0.5 \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--add-host=host.docker.internal:host-gateway \
--name auth \
localhost:5000/ic2_auth:latest
run_W1:
docker run --privileged --rm \
-p 3000:3000 \
--net IC2 --ip 172.18.0.6 \
--add-host=host.docker.internal:host-gateway \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--name ic2_portal \
localhost:5000/ic2_portal:latest
auth: build_auth run_auth
doctor: build_doctor run_doctor
W1: build_W1 run_W1
S1: build_S1 run_S1
S3: build_S3 run_S3
test: dockerRun/Makefile
sh -c "make -C dockerRun build"
# Connect inside the running container for debugging
shell:
docker exec -it $(IMAGE)
# Generate the SSL/TLS config for HTTPS
gen-ssl:
mkdir -p ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout ssl/nginx.key -out ssl/nginx.crt
clean:
docker rmi $(REPO):$(TAG)
docker image prune -f