-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
97 lines (84 loc) · 1.94 KB
/
docker-compose.yml
File metadata and controls
97 lines (84 loc) · 1.94 KB
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
version: '3.8'
services:
mailserver:
build: .
container_name: mailserver
hostname: mail.example.com
restart: unless-stopped
# Run as non-root
user: "1000:1000"
ports:
# SMTP (for receiving mail from other servers)
- "25:25"
# Submission (for sending mail from clients)
- "587:587"
# SMTPS (implicit TLS)
- "465:465"
# IMAP
- "143:143"
# IMAPS
- "993:993"
# CalDAV/CardDAV
- "8443:8443"
volumes:
# Configuration
- ./config.yaml:/etc/mailserver/config.yaml:ro
# Data persistence
- mailserver_data:/var/lib/mailserver
# DKIM keys
- ./dkim:/etc/mailserver/dkim:ro
# TLS certificates (if not using auto-TLS)
- ./certs:/etc/mailserver/certs:ro
environment:
- TZ=UTC
# Required for binding to privileged ports
cap_add:
- NET_BIND_SERVICE
# Security options
security_opt:
- no-new-privileges:true
# Resource limits
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 128M
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "993"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Redis for message queue
redis:
image: redis:7-alpine
container_name: mailserver-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes --appendfsync everysec
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
mailserver_data:
driver: local
redis_data:
driver: local
# Example networks configuration for production
# networks:
# default:
# driver: bridge
# ipam:
# config:
# - subnet: 172.20.0.0/16