This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.mk
86 lines (84 loc) · 2.26 KB
/
default.mk
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
# Handle incrementing the docker host port for instances unless a port range is defined.
DOCKER_PUBLISH := $(shell \
if [[ "$(DOCKER_PORT_MAP_TCP_11211)" != NULL ]]; \
then \
if grep -qE \
'^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:)?[1-9][0-9]*$$' \
<<< "$(DOCKER_PORT_MAP_TCP_11211)" \
&& grep -qE \
'^.+\.[0-9]+(\.[0-9]+)?$$' \
<<< "$(DOCKER_NAME)"; \
then \
printf -- ' --publish %s%s:11211/tcp' \
"$$(\
grep -o '^[0-9\.]*:' \
<<< "$(DOCKER_PORT_MAP_TCP_11211)" \
)" \
"$$(( \
$$(\
grep -oE \
'[0-9]+$$' \
<<< "$(DOCKER_PORT_MAP_TCP_11211)" \
) \
+ $$(\
grep -oE \
'([0-9]+)(\.[0-9]+)?$$' \
<<< "$(DOCKER_NAME)" \
| awk -F. \
'{ print $$1; }' \
) \
- 1 \
))"; \
else \
printf -- ' --publish %s:11211/tcp' \
"$(DOCKER_PORT_MAP_TCP_11211)"; \
fi; \
fi; \
if [[ "$(DOCKER_PORT_MAP_UDP_11211)" != NULL ]]; \
then \
if grep -qE \
'^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:)?[1-9][0-9]*$$' \
<<< "$(DOCKER_PORT_MAP_UDP_11211)" \
&& grep -qE \
'^.+\.[0-9]+(\.[0-9]+)?$$' \
<<< "$(DOCKER_NAME)"; \
then \
printf -- ' --publish %s%s:11211/udp' \
"$$(\
grep -o '^[0-9\.]*:' \
<<< "$(DOCKER_PORT_MAP_UDP_11211)" \
)" \
"$$(( \
$$(\
grep -oE \
'[0-9]+$$' \
<<< "$(DOCKER_PORT_MAP_UDP_11211)" \
) \
+ $$(\
grep -oE \
'([0-9]+)(\.[0-9]+)?$$' \
<<< "$(DOCKER_NAME)" \
| awk -F. \
'{ print $$1; }' \
) \
- 1 \
))"; \
else \
printf -- ' --publish %s:11211/udp' \
"$(DOCKER_PORT_MAP_UDP_11211)"; \
fi; \
fi; \
)
# Common parameters of create and run targets
define DOCKER_CONTAINER_PARAMETERS
--name $(DOCKER_NAME) \
--restart $(DOCKER_RESTART_POLICY) \
--sysctl "net.core.somaxconn=$(SYSCTL_NET_CORE_SOMAXCONN)" \
--sysctl "net.ipv4.ip_local_port_range=$(SYSCTL_NET_IPV4_IP_LOCAL_PORT_RANGE)" \
--sysctl "net.ipv4.route.flush=$(SYSCTL_NET_IPV4_ROUTE_FLUSH)" \
--env "ENABLE_MEMCACHED_WRAPPER=$(ENABLE_MEMCACHED_WRAPPER)" \
--env "MEMCACHED_CACHESIZE=$(MEMCACHED_CACHESIZE)" \
--env "MEMCACHED_MAXCONN=$(MEMCACHED_MAXCONN)" \
--env "MEMCACHED_OPTIONS=$(MEMCACHED_OPTIONS)" \
--env "SYSTEM_TIMEZONE=$(SYSTEM_TIMEZONE)"
endef