version: '3.1'

services:
  skandha-relayer:
    build: https://github.com/etherspot/skandha.git#3019f70b61fb409625a1a74abf3153391a232356
    environment:
      - SKANDHA_NETWORKS=${SKANDHA_NETWORKS:-}
      - SKANDHA_MAINNET_RELAYER=${SKANDHA_MAINNET_RELAYER:-}
      - SKANDHA_MAINNET_BENEFICIARY=${SKANDHA_MAINNET_BENEFICIARY:-}
      - SKANDHA_MAINNET_RPC=${SKANDHA_MAINNET_RPC:-}
      - SKANDHA_MAINNET_ENTRYPOINTS=${SKANDHA_MAINNET_ENTRYPOINTS:-}
      - SKANDHA_GOERLI_RELAYER=${SKANDHA_GOERLI_RELAYER:-}
      - SKANDHA_GOERLI_BENEFICIARY=${SKANDHA_GOERLI_BENEFICIARY:-}
      - SKANDHA_GOERLI_RPC=${SKANDHA_GOERLI_RPC:-}
      - SKANDHA_GOERLI_ENTRYPOINTS=${SKANDHA_GOERLI_ENTRYPOINTS:-}      
      - SKANDHA_XDAI_RELAYER=${SKANDHA_XDAI_RELAYER:-}
      - SKANDHA_XDAI_BENEFICIARY=${SKANDHA_XDAI_BENEFICIARY:-}
      - SKANDHA_XDAI_RPC=${SKANDHA_XDAI_RPC:-}
      - SKANDHA_XDAI_ENTRYPOINTS=${SKANDHA_XDAI_ENTRYPOINTS:-}
      - SKANDHA_FANTOM_RELAYER=${SKANDHA_FANTOM_RELAYER:-}
      - SKANDHA_FANTOM_BENEFICIARY=${SKANDHA_FANTOM_BENEFICIARY:-}
      - SKANDHA_FANTOM_RPC=${SKANDHA_FANTOM_RPC:-}
      - SKANDHA_FANTOM_ENTRYPOINTS=${SKANDHA_FANTOM_ENTRYPOINTS:-}
      - SKANDHA_MATIC_RELAYER=${SKANDHA_MATIC_RELAYER:-}
      - SKANDHA_MATIC_BENEFICIARY=${SKANDHA_MATIC_BENEFICIARY:-}
      - SKANDHA_MATIC_RPC=${SKANDHA_MATIC_RPC:-}
      - SKANDHA_MATIC_ENTRYPOINTS=${SKANDHA_MATIC_ENTRYPOINTS:-}
      - SKANDHA_AVALANCHE_RELAYER=${SKANDHA_AVALANCHE_RELAYER:-}
      - SKANDHA_AVALANCHE_BENEFICIARY=${SKANDHA_AVALANCHE_BENEFICIARY:-}
      - SKANDHA_AVALANCHE_RPC=${SKANDHA_AVALANCHE_RPC:-}
      - SKANDHA_AVALANCHE_ENTRYPOINTS=${SKANDHA_AVALANCHE_ENTRYPOINTS:-}
      - SKANDHA_OPTIMISM_RELAYER=${SKANDHA_OPTIMISM_RELAYER:-}
      - SKANDHA_OPTIMISM_BENEFICIARY=${SKANDHA_OPTIMISM_BENEFICIARY:-}
      - SKANDHA_OPTIMISM_RPC=${SKANDHA_OPTIMISM_RPC:-}
      - SKANDHA_OPTIMISM_ENTRYPOINTS=${SKANDHA_OPTIMISM_ENTRYPOINTS:-}
      - SKANDHA_ARBITRUM_RELAYER=${SKANDHA_ARBITRUM_RELAYER:-}
      - SKANDHA_ARBITRUM_BENEFICIARY=${SKANDHA_ARBITRUM_BENEFICIARY:-}
      - SKANDHA_ARBITRUM_RPC=${SKANDHA_ARBITRUM_RPC:-}
      - SKANDHA_ARBITRUM_ENTRYPOINTS=${SKANDHA_ARBITRUM_ENTRYPOINTS:-}
      - SKANDHA_POLYGONZKEVM_RELAYER=${SKANDHA_POLYGONZKEVM_RELAYER:-}
      - SKANDHA_POLYGONZKEVM_BENEFICIARY=${SKANDHA_POLYGONZKEVM_BENEFICIARY:-}
      - SKANDHA_POLYGONZKEVM_RPC=${SKANDHA_POLYGONZKEVM_RPC:-}
      - SKANDHA_POLYGONZKEVM_ENTRYPOINTS=${SKANDHA_POLYGONZKEVM_ENTRYPOINTS:-}
      #    volumes:
      #      - type: bind
      #        source: ./skandha/config.json
      #        target: /usr/app/config.json
      #        read_only: true
    command: start --redirectRpc
    expose:
      - "14337"
    ports:
      - "127.0.0.1:14337:14337"
    restart: unless-stopped
    stop_grace_period: 1m
    labels:
      - "traefik.http.middlewares.skandha-relayer-stripprefix.stripprefix.prefixes=/skandha-relayer"
      - "traefik.http.services.skandha-relayer.loadbalancer.server.port=14337"
      - "traefik.http.routers.skandha-relayer.entrypoints=websecure"
      - "traefik.http.routers.skandha-relayer.tls.certresolver=myresolver"
      - "traefik.http.routers.skandha-relayer.rule=Host(`$DOMAIN`) && PathPrefix(`/skandha-relayer`)"
      - "traefik.http.routers.skandha-relayer.middlewares=skandha-relayer-stripprefix, ipwhitelist"
    networks:
      - chains

