docker-compose-collection/traefik/docker-compose.yaml

28 lines
1.1 KiB
YAML
Raw Permalink Normal View History

2023-02-05 16:32:56 +08:00
# Please replace xxx with your configuraiton
version: "3"
services:
traefik:
image: traefik:latest
container_name: traefik
network_mode: host
restart: unless-stopped
environment:
- CLOUDFLARE_EMAIL=xxx@xxx
- CLOUDFLARE_DNS_API_TOKEN=xxx
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs:/letsencrypt
- ./dashboard_authfile:/dashboard_authfile:ro
- ./dynamic.yml:/dynamic.yml
- ./traefik.yml:/traefik.yml:ro
labels:
- "traefik.enable=true"
- 'traefik.http.routers.traefik.rule=Host(`xxx.domain`)'
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.tls.certresolver=letsencrypt"
- "traefik.http.routers.traefik.service=api@internal"
- 'traefik.http.routers.traefik.middlewares=strip,basic-auth-global'
- 'traefik.http.middlewares.strip.stripprefix.prefixes=/traefik'
- "traefik.http.services.traefik.loadbalancer.server.port=443"
- "traefik.http.middlewares.basic-auth-global.basicauth.usersfile=/dashboard_authfile"