Files
traefik/compose.yaml
T

90 lines
2.3 KiB
YAML

services:
traefik:
image: ${TRAEFIK_IMAGE:-traefik:latest}
container_name: traefik
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
command:
- --configFile=/etc/traefik/traefik.yaml
volumes:
- type: bind
source: ${TRAEFIK_ACME:?TRAEFIK_ACME must be set}
target: /letsencrypt
read_only: false
bind:
create_host_path: false
- type: bind
source: ${TRAEFIK_YAML:-./traefik/traefik.yaml}
target: /etc/traefik/traefik.yaml
read_only: true
bind:
create_host_path: false
- type: bind
source: ./traefik/conf.d
target: /etc/traefik/conf.d/base
read_only: true
bind:
create_host_path: false
- type: bind
source: ${TRAEFIK_CONFD:-./traefik/conf.local}
target: /etc/traefik/conf.d/local
read_only: true
bind:
create_host_path: false
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
bind:
create_host_path: false
networks:
- proxy
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=${NETWORK_NAME:-docknet}'
- 'traefik.http.routers.api.rule=Host(`${CONSOLE_HOST}`)'
- 'traefik.http.routers.api.entrypoints=websecure'
- 'traefik.http.routers.api.service=api@internal'
- 'traefik.http.routers.api.tls=true'
- 'traefik.http.routers.api.tls.certresolver=letsencrypt'
- 'traefik.http.routers.api.middlewares=traefik-auth'
- 'traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_CONSOLE_AUTH}'
ports:
- "${TRAEFIK_HTTP_PORT:-8342}:80"
- "${TRAEFIK_HTTPS_PORT:-8767}:443"
- "${TRAEFIK_DASHBOARD_PORT:-8080}:8080"
environment:
- CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
- CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
healthcheck:
test: [ "CMD", "traefik", "healthcheck", "--ping" ]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
logging:
driver: json-file
options:
max-size: "1m"
max-file: "3"
compress: "true"
networks:
proxy:
name: ${NETWORK_NAME:-docknet}
external: true