41 lines
1.2 KiB
Django/Jinja
41 lines
1.2 KiB
Django/Jinja
name: traefik
|
|
|
|
services:
|
|
traefik:
|
|
image: "{{ traefik_image }}"
|
|
container_name: traefik
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- "{{ traefik_config_dir }}/traefik.yml:/etc/traefik/traefik.yml:ro"
|
|
- "{{ traefik_data_dir }}:/data"
|
|
{% if traefik_custom_ca_enabled | default(false) %}
|
|
- "{{ traefik_custom_ca_path }}:/etc/ssl/certs/custom-ca.pem:ro"
|
|
{% endif %}
|
|
networks:
|
|
{% for network in traefik_networks %}
|
|
- "{{ network.name }}"
|
|
{% endfor %}
|
|
{% if traefik_custom_ca_enabled | default(false) %}
|
|
environment:
|
|
- LEGO_CA_CERTIFICATES=/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/custom-ca.pem
|
|
{% endif %}
|
|
command:
|
|
- --configfile=/etc/traefik/traefik.yml
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.{{ traefik_domain | default('localhost') }}`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
|
|
- "traefik.http.routers.traefik-dashboard.service=api@internal"
|
|
|
|
networks:
|
|
{% for network in traefik_networks %}
|
|
{{ network.name }}:
|
|
{% if network.external | default(false) %}
|
|
external: true
|
|
{% else %}
|
|
driver: bridge
|
|
{% endif %}
|
|
{% endfor %}
|