Traefik 2.x Docker provider configuration

# This is an example docker-compose file.
# It will not run without configuring a working application.yamlwith your credentials from Auth0.
# Have a look at the files in the example directory as a starting point how to create the two files.
#
# Using Docker-Compose and Dynamic configuration with Docker provider in Traefik, auto discovery of
# running containers will register containers according to the configuration with labels.
# See https://docs.traefik.io/v2.0/reference/dynamic-configuration/docker/ for possible config.
version: '2.4'
services:
  traefik:
    image: traefik:2.4
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./:/etc/traefik
    labels:
      # Catch all incoming requests on HTTP and redirect to HTTPS
      - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:[a-z-.]+}`)"
      - "traefik.http.routers.http-catchall.entrypoints=http"
      - "traefik.http.routers.http-catchall.middlewares=https-redirect@file"

      # listen for https requests and use forward auth.
      # Terminate SSL, whoami doesnt listen on SSL traffic, whoami is listening on plain text unencrypted http connections.
      # https://docs.traefik.io/v2.0/routing/routers/#tls
      - "traefik.http.routers.dashboard.tls"
      - "traefik.http.routers.dashboard.entrypoints=https"
      - "traefik.http.routers.dashboard.middlewares=secured@file"
      - "traefik.http.routers.dashboard.rule=Host(`traefik.example.test`)"
      - "traefik.http.services.dashboard.LoadBalancer.server.Port=8080"

  whoami:
    image: containous/whoami
    labels:
      - "traefik.http.routers.whoami.tls"
      - "traefik.http.routers.whoami.rule=Host(`whoami.example.test`)"
      - "traefik.http.routers.whoami.entrypoints=https"
      - "traefik.http.routers.whoami.middlewares=secured@file"

  www:
    image: dniel/blogr-www
    labels:
      - "traefik.http.routers.www.tls"
      - "traefik.http.routers.www.middlewares=secured@file"
      - "traefik.http.routers.www.entrypoints=https"
      - "traefik.http.routers.www.rule=Host(`www.example.test`)"

  graphql:
    image: dniel/api-graphql
    labels:
      - "traefik.http.routers.graphql.tls"
      - "traefik.http.routers.graphql.rule=Host(`graphql.example.test`)"
      - "traefik.http.routers.graphql.entrypoints=https"
      - "traefik.http.routers.graphql.middlewares=secured@file"

#################################################################
# ForwardAuth service.
# This is used when running the whole stack in docker-compose.
#
# Not very suitable for development of ForwardAuth because of 
# the long code round trip with alot of steps to update the 
# docker container with a new version. 
#  - compile 
#  - assemble new docker image
#  - restart docker-compose 
#  - test
#  - fix problems found
#  - repeat from step 1 until satisfied.
# 
# In development mode, use the File provider to point
# auth.example.test to your development environment 
# on your local machineConfig where you can update the code faster.
#################################################################
#  auth:
#    image: dniel/forwardauth
#    mem_limit: 512m
#    mem_reservation: 256m
#    ports:
#      - 8080
#    labels:
#      - "traefik.http.routers.auth.rule=Host(`auth.example.test`)"
#    volumes:
#      - ../../config/application.yaml:/config/application.yaml