version: "3.7"
networks:
smarthome:
external:
name: smarthome
services:
reverse-proxy:
container_name: traefik
image: traefik:v2.0
hostname: traefik
restart: always
environment:
- TZ=${TZ}
domainname: ${DOMAIN_NAME}
networks:
smarthome:
ipv4_address: ${traefik_ip}
ports:
- "80:80" # The HTTP port
- "443:443" # The HTTPS port
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # So that Traefik can listen to the Docker events
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ${USERDIR}/traefik_v2:/etc/traefik
- ${USERDIR}/shared/:/shared/:ro
labels:
- "traefik.enable=true"
- "
traefik.docker.network=smarthome"
- "traefik.http.routers.traefik_router0.entrypoints=web"
- "traefik.http.routers.traefik_router0.service=reverse-proxy"
- "traefik.http.routers.traefik_router0.middlewares=redirect@file"
- "traefik.http.routers.traefik_router0.rule=Host(`traefik.${DOMAIN_NAME}`)"
- "traefik.http.routers.traefik_router1.entrypoints=web-secure"
- "traefik.http.routers.traefik_router1.service=reverse-proxy"
- "traefik.http.routers.traefik_router1.middlewares=auth@file"
- "traefik.http.routers.traefik_router1.rule=Host(`traefik.${DOMAIN_NAME}`)"
- "traefik.http.routers.traefik_router1.tls=true"
- "
traefik.http.routers.traefik_router1.tls.domains[0].main=${DOMAIN_NAME}"
- "
traefik.http.routers.traefik_router1.tls.domains[0].sans=*.${DOMAIN_NAME}"
- "traefik.http.routers.traefik_router1.tls.options=mintls13@file"
- "traefik.http.services.reverse-proxy.loadbalancer.server.port=8080"