Sign inSign up

codingjoe/the-box-smtp:main

Manifest digest

sha256:c0634ca1dfa3b2d725d2fa53ca263c30c870b9226bb5cadb191d8d3b6820418f

Last pushed

7 months by codingjoe

Type

Compose

Manifest digest

sha256:c0634ca1dfa3b2d725d2fa53ca263c30c870b9226bb5cadb191d8d3b6820418f

Compose file content

name: containers
networks:
  app:
    internal: true
    name: containers_app
  app-wan:
    name: containers_app-wan
  caddy:
    external: true
    name: caddy
  smtp-wan:
    name: smtp-wan
services:
  smtp:
    container_name: smtp
    deploy:
      mode: global
    domainname: ${HOSTNAME}
    environment:
      LOG_LEVEL: info
      NETWORK_INTERFACE: eth1
      ONE_DIR: 1
      PERMIT_DOCKER: connected-networks
      POSTFIX_INET_PROTOCOLS: ipv4
      SMTP_ONLY: 1
      SSL_TYPE: ""
    healthcheck:
      interval: 10s
      retries: 5
      start_period: 30s
      test: ss --listening --ipv4 --tcp | grep --silent ':smtp' || exit 1
      timeout: 3s
    hostname: smtp
    image: ghcr.io/docker-mailserver/docker-mailserver:15.1.0
    labels:
      - dev.dozzle.group=the-box
    networks:
      app:
        interface_name: eth1
      smtp-wan:
        interface_name: eth0
    restart: always
    stop_grace_period: 1m
    volumes:
      - source: smtp-data
        target: /var/mail
        type: volume
        volume: {}
      - source: smtp-state
        target: /var/mail-state
        type: volume
        volume: {}
      - source: smtp-config
        target: /tmp/docker-mailserver
        type: volume
        volume: {}
      - bind:
          create_host_path: true
        read_only: true
        source: /etc/localtime
        target: /etc/localtime
        type: bind
  web:
    depends_on:
      smtp:
        condition: service_healthy
        required: true
    deploy:
      mode: replicated
      replicas: 2
      resources:
        limits:
          cpus: "2"
          memory: 512M
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      update_config:
        delay: 1m
        failure_action: rollback
        monitor: 1m
        order: start-first
        parallelism: 1
    environment:
      - HOSTNAME=${HOSTNAME:-localhost}
      - PORT=${PORT:-8000}
      - EMAIL_URL=smtp://smtp:25/
    image: traefik/whoami:latest
    labels:
      - caddy=${HOSTNAME:-localhost}
      - caddy.reverse_proxy={{upstreams ${PORT:-8000}}}
      - caddy.reverse_proxy.lb_policy=round_robin
      - caddy.reverse_proxy.health_uri=/
      - caddy.reverse_proxy.health_headers.X-Forwarded-Host=${HOSTNAME:-localhost}
      - caddy.reverse_proxy.health_headers.X-Forwarded-Proto=https
    networks:
      app: null
      app-wan: null
      caddy: null
    stop_grace_period: 1m
volumes:
  smtp-config:
    name: containers_smtp-config
  smtp-data:
    name: containers_smtp-data
  smtp-state:
    name: containers_smtp-state

Docker commands

docker compose -f oci://codingjoe/the-box-smtp:main up

Use the above command to pull and run the Compose file. Learn more.

Images used

Image

Tiny Go webserver that prints OS information and HTTP request to output


Pulls

10M+

Stars

72

Last Updated

about 2 months