homelab/roles/traefik/templates/docker-compose.yml.j2

43 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-04-08 17:09:04 +00:00
version: '3.7'
networks:
traefik:
name: traefik
services:
traefik:
image: "traefik:${traefik_version}"
container_name: "${traefik_name}"
command:
- --api.dashboard=${traefik_dashboard:-false}
- --api.debug=${traefik_debug:-false}
- --providers.docker=true
- --entrypoints.web.address=:80
{% if traefik_standalone %}
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.permanent=true
- --entrypoints.websecure.address=:443
{% endif %}
ports:
- "${traefik_web_entry:-80:80}"
{% if traefik_standalone %}
- "${traefik_websecure_entry:-443:443}"
{% endif %}
networks:
- traefik
labels:
- "traefik.http.routers.traefik.rule=Host(`{{ traefik_domain }}`)"
- "traefik.http.routers.traefik.service=api@internal"
{% if traefik_standalone %}
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.tls=true"
{% else %}
- "traefik.http.routers.traefik.entrypoints=web"
{% endif %}
- "traefik.docker.network=traefik"
- "traefik.enable=${traefik_dashboard:-false}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "{{ traefik_root }}/config:/etc/traefik"