docker-compose.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. services:
  2. app:
  3. build:
  4. context: .
  5. container_name: mailhub-app
  6. restart: unless-stopped
  7. env_file:
  8. - .env
  9. environment:
  10. PORT: 3000
  11. DATA_DIR: /data
  12. POSTFIX_LOG_FILE: /data/postfix-logs/mail.log
  13. ports:
  14. - "127.0.0.1:${APP_PORT:-3025}:3000"
  15. - "${SUBMISSION_BIND:-0.0.0.0}:25:25"
  16. - "${SUBMISSION_BIND:-0.0.0.0}:465:465"
  17. - "${SUBMISSION_BIND:-0.0.0.0}:587:587"
  18. - "${SUBMISSION_BIND:-0.0.0.0}:${SUBMISSION_ALT_PORT:-2525}:2525"
  19. - "${IMAP_BIND:-0.0.0.0}:143:143"
  20. - "${IMAP_BIND:-0.0.0.0}:993:993"
  21. - "${POP3_BIND:-0.0.0.0}:110:110"
  22. - "${POP3_BIND:-0.0.0.0}:995:995"
  23. volumes:
  24. - ./data:/data
  25. - ./certs:/certs:ro
  26. depends_on:
  27. postfix:
  28. condition: service_started
  29. healthcheck:
  30. test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
  31. interval: 30s
  32. timeout: 5s
  33. retries: 3
  34. start_period: 15s
  35. postfix:
  36. build:
  37. context: ./docker/postfix
  38. container_name: mailhub-postfix
  39. restart: unless-stopped
  40. env_file:
  41. - .env
  42. environment:
  43. POSTFIX_LOG_FILE: /var/log/mailhub/mail.log
  44. hostname: ${MAIL_HOSTNAME:-mailhub.local}
  45. volumes:
  46. - ./data/postfix-logs:/var/log/mailhub
  47. healthcheck:
  48. test: ["CMD-SHELL", "postfix status >/dev/null 2>&1 || exit 1"]
  49. interval: 30s
  50. timeout: 5s
  51. retries: 3
  52. start_period: 20s