services:
  benchmark-proxy:
    build:
      context: ./benchmark-proxy
      dockerfile: Dockerfile
    expose:
      - "8080"
    environment:
      - LISTEN_ADDR=:8080
      - SUMMARY_INTERVAL=60
      - PRIMARY_BACKEND=${BENCHMARK_PROXY_PRIMARY_BACKEND}
      - SECONDARY_BACKENDS=${BENCHMARK_PROXY_SECONDARY_BACKENDS}
    restart: unless-stopped
    networks:
      - chains
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.benchmark-proxy-stripprefix.stripprefix.prefixes=/benchmark"
      - "traefik.http.services.benchmark-proxy.loadbalancer.server.port=8080"
      - "${NO_SSL:-traefik.http.routers.benchmark-proxy.entrypoints=websecure}"
      - "${NO_SSL:-traefik.http.routers.benchmark-proxy.tls.certresolver=myresolver}"
      - "${NO_SSL:-traefik.http.routers.benchmark-proxy.rule=Host(`$DOMAIN`) && PathPrefix(`/benchmark`)}"
      - "${NO_SSL:+traefik.http.routers.benchmark-proxy.rule=PathPrefix(`/benchmark`)}"      
      - "traefik.http.routers.benchmark-proxy.middlewares=benchmark-proxy-stripprefix, ipwhitelist"