#Great source !
#https://betterprogramming.pub/build-a-discord-bot-with-aws-lambda-api-gateway-cc1cff750292
#https://ianmitchell.dev/blog/creating-a-discord-http-slash-command-bot-with-fastify

version: '3.8'
services:
  web:
    build:
      context: ./
    #volumes:
    #  - botsrc:/app
    command: node server.js
    labels:
      - traefik.enable=true
      - traefik.http.routers.bot-discord${USER_ID:-1}.rule=Host(`${URL_BOT}`)
      - traefik.http.routers.bot-discord${USER_ID:-1}.entrypoints=websecure
      - traefik.http.routers.bot-discord${USER_ID:-1}.tls=true
      - traefik.http.routers.bot-discord${USER_ID:-1}.tls.certresolver=lets-encrypt
      - traefik.http.services.bot-discord${USER_ID:-1}.loadbalancer.server.port=3000
      - traefik.docker.network=${NETWORK_TRAEFIK}
    networks:
      - traefik-proxy
    environment:
      APPLICATION_ID: ${APPLICATION_ID}
      PUBLIC_KEY: ${PUBLIC_KEY}
      TOKEN: ${TOKEN}
      GUILD_ID: ${GUILD_ID}
      URL_WEBHOOK: ${URL_WEBHOOK}
      API_KEY: ${API_KEY}


networks:
  traefik-proxy:
    external:
      name: ${NETWORK_TRAEFIK}

volumes:      
  botsrc:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_BOTSRC}
      o: bind