# Two independent setups, selected with --profile so they don't both start by accident: # # docker compose --profile standalone up -d --build # mailserver only # docker compose --profile with-rspamd up -d --build # mailserver + rspamd, same container # # Both default to the standard mail ports on the host (25/465/143/993) — the app itself # now binds those directly, no port remapping needed — plus the app's own non-privileged # web ports (5000/5001; put a reverse proxy or your own 80/443 mapping in front of those # if you want the dashboard on standard web ports too). Only run one profile at a time # unless you've overridden the host ports for one of them (see .env.example) — they'd # otherwise both try to bind the same host ports. services: mailserver: build: context: .. dockerfile: docker-deploy/Dockerfile container_name: mailgoserver restart: unless-stopped profiles: ["standalone"] ports: - "${SMTP_PORT:-25}:25" - "${SMTP_TLS_PORT:-465}:465" - "${IMAP_PORT:-143}:143" - "${IMAP_TLS_PORT:-993}:993" - "${WEB_HTTP_PORT:-5000}:5000" - "${WEB_HTTPS_PORT:-5001}:5001" volumes: - mailserver-data:/app/data mailserver-rspamd: build: context: .. dockerfile: docker-deploy/Dockerfile.rspamd container_name: mailgoserver-rspamd restart: unless-stopped profiles: ["with-rspamd"] ports: - "${SMTP_PORT:-25}:25" - "${SMTP_TLS_PORT:-465}:465" - "${IMAP_PORT:-143}:143" - "${IMAP_TLS_PORT:-993}:993" - "${WEB_HTTP_PORT:-5000}:5000" - "${WEB_HTTPS_PORT:-5001}:5001" volumes: - mailserver-rspamd-data:/app/data - rspamd-data:/var/lib/rspamd volumes: mailserver-data: mailserver-rspamd-data: rspamd-data: