-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yaml
163 lines (152 loc) · 3.6 KB
/
docker-compose.yaml
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
163
version: '3.1'
networks:
front:
driver: bridge
ipam:
config:
- subnet: 10.0.0.0/30
back:
driver: bridge
ipam:
config:
- subnet: 10.0.1.0/28
services:
db:
image: "mariadb:latest"
container_name: mailserver-db
command: --default-authentication-plugin=mysql_native_password --bind-address=10.0.1.2
restart: always
env_file:
- db.env
volumes:
- "${DB_FILES:-/srv/mailserver/db}:/var/lib/mysql"
networks:
back:
ipv4_address: 10.0.1.2
secrets:
- mysql_root_pwd
- mysql_db
- mysql_user
- mysql_pwd
memcached:
image: "memcached:latest"
container_name: mailserver-memcached
networks:
back:
ipv4_address: 10.0.1.3
opendkim:
image: opendkim
build:
context: opendkim
container_name: mailserver-opendkim
env_file:
- mail.env
volumes:
- "/dev/log:/dev/log"
- "${OPENDKIM_FILES:-/srv/mailserver/opendkim}:/config"
- "${DKIM_PRIVKEY:-/ssl/dkim.key}:/etc/dkimkeys/dkim.key"
restart: always
networks:
back:
ipv4_address: 10.0.1.4
dovecot:
image: "dovecot:latest"
build:
context: dovecot
container_name: mailserver-dovecot
restart: always
env_file:
- db.env
- mail.env
extra_hosts:
db_host: 10.0.1.2
postfix_host: 10.0.1.6
volumes:
- "${DOVECOT_CRT:-/ssl/ssl.crt}:/ssl/ssl.crt"
- "${DOVECOT_KEY:-/ssl/ssl.key}:/ssl/ssl.key"
- "${DOVECOT_FILES:-/srv/mailserver/dovecot}:/config"
- "${DOVECOT_LOGS:-/srv/mailserver/dovecot/logs}:/config/logs"
- "${MAILDIR:-/srv/mailserver/maildir}:/var/mail/vhosts"
ports:
- "143:143"
- "993:993"
networks:
back:
ipv4_address: 10.0.1.5
secrets:
- mysql_db
- mysql_user
- mysql_pwd
depends_on:
- "db"
postfix:
image: "postfix:latest"
build:
context: postfix
container_name: mailserver-postfix
restart: always
env_file:
- db.env
- mail.env
extra_hosts:
db_host: 10.0.1.2
opendkim_host: 10.0.1.4
dovecot_host: 10.0.1.5
volumes:
- "/dev/log:/dev/log"
- "${POSTFIX_CRT:-/ssl/ssl.crt}:/ssl/ssl.crt"
- "${POSTFIX_KEY:-/ssl/ssl.key}:/ssl/ssl.key"
- "${POSTFIX_FILES:-/srv/mailserver/postfix}:/config"
ports:
- "25:25"
- "465:465"
- "587:587"
networks:
back:
ipv4_address: 10.0.1.6
secrets:
- mysql_db
- mysql_user
- mysql_pwd
depends_on:
- "db"
vimbadmin:
image: "vimbadmin:latest"
build:
context: vimbadmin
container_name: mailserver-vimbadmin
restart: always
env_file:
- db.env
- mail.env
extra_hosts:
db_host: 10.0.1.2
memcached_host: 10.0.1.3
dovecot_host: 10.0.1.5
postfix_host: 10.0.1.6
volumes:
- "${VIMBADMIN_CRT:-/ssl/ssl.crt}:/ssl/ssl.crt"
- "${VIMBADMIN_KEY:-/ssl/ssl.key}:/ssl/ssl.key"
- "${VIMBADMIN_FILES:-/srv/mailserver/vimbadmin}:/config"
ports:
- "8443:443"
networks:
front:
ipv4_address: 10.0.0.2
back:
ipv4_address: 10.0.1.7
secrets:
- mysql_db
- mysql_user
- mysql_pwd
depends_on:
- "db"
secrets:
mysql_root_pwd:
file: secrets/mysql_root_pwd.txt # put mysql root pwd to this file
mysql_db:
file: secrets/mysql_db.txt # put mysql db name to this file
mysql_pwd:
file: secrets/mysql_pwd.txt # put mysql password to this file
mysql_user:
file: secrets/mysql_user.txt # put mysql username to this file