This repository has been archived by the owner on Jan 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (58 loc) · 2.06 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
NSPACE=petelealiieej
APP=perseverance-tracker
VER=0.1
RPORT=6415
FPORT=5015
UID=876512
GID=816966
list-targets:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
list:
docker ps -a | grep ${NSPACE} || true
docker images | grep ${NSPACE} || true
build-db:
docker pull redis:6
build-api:
docker build -t ${NSPACE}/${APP}-api:${VER} \
-f docker/Dockerfile.api \
./
build-wrk:
docker build -t ${NSPACE}/${APP}-wrk:${VER} \
-f docker/Dockerfile.wrk \
./
run-db: build-db
docker run --name ${NSPACE}-db \
-p ${RPORT}:6379 \
-d \
-u ${UID}:${GID} \
-v ${PWD}/data/:/data \
redis:6 \
--save 1 1
run-api: build-api
docker run --name ${NSPACE}-api \
--env REDIS_IP=$$(docker inspect ${NSPACE}-db | grep \"IPAddress\" | head -n1 | awk -F\" '{print $$4}') \
-p ${FPORT}:5000 \
-d \
${NSPACE}/${APP}-api:${VER}
run-wrk: build-wrk
docker run --name ${NSPACE}-wrk \
--env REDIS_IP=$$(docker inspect ${NSPACE}-db | grep \"IPAddress\" | head -n1 | awk -F\" '{print $$4}') \
-d \
${NSPACE}/${APP}-wrk:${VER}
clean-db:
docker stop ${NSPACE}-db && docker rm -f ${NSPACE}-db || true
clean-api:
docker stop ${NSPACE}-api && docker rm -f ${NSPACE}-api || true
clean-wrk:
docker stop ${NSPACE}-wrk && docker rm -f ${NSPACE}-wrk || true
push-api:
docker push ${NSPACE}/${APP}-api:${VER}
push-wrk:
docker push ${NSPACE}/${APP}-wrk:${VER}
redis-ip:
echo $$(docker inspect ${NSPACE}-db | grep \"IPAddress\" | head -n1 | awk -F\" '{print $$4}')
build-all: build-db build-api build-wrk
run-all: run-db run-api run-wrk
clean-all: clean-db clean-api clean-wrk
push-all: push-api push-wrk
all: clean-all build-all run-all