version: '3.1'

services:
  skandha-mainnet:
#    build: https://github.com/etherspot/skandha.git#3019f70b61fb409625a1a74abf3153391a232356
    image: etherspot/skandha:0.0.31
    environment:
      - SKANDHA_NETWORKS=mainnet
      - SKANDHA_MAINNET_RELAYER=${SKANDHA_MAINNET_RELAYER:-}
      - SKANDHA_MAINNET_BENEFICIARY=${SKANDHA_MAINNET_BENEFICIARY:-}
      - SKANDHA_MAINNET_RPC=${SKANDHA_MAINNET_RPC:-}
      - SKANDHA_MAINNET_ENTRYPOINTS=${SKANDHA_MAINNET_ENTRYPOINTS:-}
    command: start --redirectRpc
    expose:
      - "14337"
    restart: unless-stopped
    volumes:
      - "skandha-mainnet-db:/usr/app/db"
    stop_grace_period: 1m
    labels:
      - "traefik.enable=true"      
      - "traefik.http.middlewares.skandha-mainnet-replacepath.replacepath.path=/1"
      - "traefik.http.middlewares.skandha-mainnet-stripprefix.stripprefix.prefixes=/skandha-mainnet"
      - "traefik.http.services.skandha-mainnet.loadbalancer.server.port=14337"
      - "traefik.http.routers.skandha-mainnet.entrypoints=websecure"
      - "traefik.http.routers.skandha-mainnet.tls.certresolver=myresolver"
      - "traefik.http.routers.skandha-mainnet.rule=Host(`$DOMAIN`) && PathPrefix(`/skandha-mainnet`)"
      - "traefik.http.routers.skandha-mainnet.middlewares=skandha-mainnet-stripprefix, skandha-mainnet-replacepath, ipwhitelist"
    networks:
      - chains

volumes:
  skandha-mainnet-db:
