docker-compose.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. volumes:
  20. - ./data:/data
  21. - ./certs:/certs:ro
  22. depends_on:
  23. postfix:
  24. condition: service_started
  25. healthcheck:
  26. test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
  27. interval: 30s
  28. timeout: 5s
  29. retries: 3
  30. start_period: 15s
  31. postfix:
  32. build:
  33. context: ./docker/postfix
  34. container_name: mailhub-postfix
  35. restart: unless-stopped
  36. env_file:
  37. - .env
  38. environment:
  39. POSTFIX_LOG_FILE: /var/log/mailhub/mail.log
  40. hostname: ${MAIL_HOSTNAME:-ali.ss5.xyz}
  41. volumes:
  42. - ./data/postfix-logs:/var/log/mailhub
  43. healthcheck:
  44. test: ["CMD-SHELL", "postfix status >/dev/null 2>&1 || exit 1"]
  45. interval: 30s
  46. timeout: 5s
  47. retries: 3
  48. start_period: 20s