Files
newsletter-hackernews/docker-compose.yml

47 lines
1.3 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: newsletter-db
environment:
- POSTGRES_USER=newsletter
- POSTGRES_PASSWORD=newsletter
- POSTGRES_DB=newsletter
ports:
- '5432:5432'
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U newsletter"]
interval: 10s
timeout: 5s
retries: 5
# Postfix mail server with OpenDKIM for self-hosted email
postfix:
build: ./docker/postfix
container_name: newsletter-postfix
restart: always
# dns: Uses VPS default DNS. If MX lookups fail, uncomment and set explicit DNS:
# - 213.186.33.99 # OVH DNS
environment:
- MAIL_DOMAIN=${MAIL_DOMAIN:-example.com}
- MAIL_HOSTNAME=${MAIL_HOSTNAME:-mail.example.com}
- DKIM_SELECTOR=${DKIM_SELECTOR:-mail}
volumes:
# Persist DKIM keys across container rebuilds
- postfix-dkim:/etc/opendkim/keys
# Persist mail queue
- postfix-spool:/var/spool/postfix
# Port 25 not exposed to host - only accessible within Docker network
healthcheck:
test: ["CMD-SHELL", "echo 'QUIT' | nc -w 5 localhost 25 | grep -q '220' || exit 1"]
interval: 30s
timeout: 10s
start_period: 10s
retries: 3
volumes:
postgres-data:
postfix-dkim:
postfix-spool: