
version: "3"

services:

  cw:

    image: 42wim/matterbridge:1.26
    restart: always
    volumes:
      - /srv/matterbridge/etc/matterbridge_cw.toml:/matterbridge.toml:ro
      - /srv/matterbridge/media/:/media/:rw,z
    networks:
      - default


  wz:

    image: 42wim/matterbridge:1.26
    restart: always
    volumes:
      - /srv/matterbridge/etc/matterbridge_wz.toml:/matterbridge.toml:ro
      - /srv/matterbridge/media/:/media/:rw,z
    networks:
      - default


  web:

    image: nginx:1.21.6-alpine
    restart: always
    volumes:
      - /srv/matterbridge/media/:/usr/share/nginx/html/matterbridge/:ro,z
    environment:
      - NGINX_HOST={{ domain }}
      - NGINX_PORT=80
    labels:
      - traefik.enable=true
      - traefik.http.routers.{{ servicename }}.rule=((Host(`{{ domain }}`) && PathPrefix(`/matterbridge`)))
      - traefik.http.routers.{{ servicename }}.entrypoints=websecure
      - traefik.http.services.{{ servicename }}.loadbalancer.server.port=80
    networks:
      - web


  restarter:
    
    image: docker:20.10
    restart: always
    command: [ "/bin/sh", "-c", "while true; do sleep 1h; docker restart matterbridge_cw_1; docker restart matterbridge_wz_1; done" ]
    volumes: 
      - "/var/run/docker.sock:/var/run/docker.sock"


networks:
  web:
    external: true
