Created
July 14, 2021 13:24
-
-
Save luojiyin1987/61cf6616f9b0d456ed8425d70e1701d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3" | |
| services: | |
| traefik: | |
| container_name: traefik | |
| image: traefik:v2.4.8 | |
| restart: always | |
| ports: | |
| - 80:80 | |
| - 443:443 | |
| networks: | |
| - traefik | |
| environment: | |
| - CF_API_EMAIL= | |
| - CLOUDFLARE_DNS_API_TOKEN= | |
| - CLOUDFLARE_ZONE_API_TOKEN= | |
| command: | |
| - "--global.sendanonymoususage=false" | |
| - "--global.checknewversion=false" | |
| - "--entrypoints.http.address=:80" | |
| - "--entrypoints.https.address=:443" | |
| - "--entryPoints.http.forwardedHeaders.trustedIPs=127.0.0.1/32,172.18.0.1/24" | |
| - "--entryPoints.https.forwardedHeaders.trustedIPs=127.0.0.1/32,172.18.0.1/24" | |
| - "--api=true" | |
| - "--api.insecure=true" | |
| - "--api.dashboard=true" | |
| - "--api.debug=false" | |
| - "--ping=true" | |
| - "--log.level=warn" | |
| - "--log.format=common" | |
| - "--accesslog=false" | |
| - "--providers.docker=true" | |
| - "--providers.docker.watch=true" | |
| - "--providers.docker.exposedbydefault=false" | |
| - "--providers.docker.endpoint=unix:///var/run/docker.sock" | |
| - "--providers.docker.swarmMode=false" | |
| - "--providers.docker.useBindPortIP=false" | |
| - "--providers.docker.network=traefik" | |
| - "--providers.file=true" | |
| - "--providers.file.watch=true" | |
| - "--providers.file.directory=/etc/traefik/config" | |
| - "--providers.file.debugloggeneratedtemplate=true" | |
| - "[email protected]" | |
| - "--certificatesresolvers.le.acme.storage=/data/ssl/acme.json" | |
| - "--certificatesresolvers.le.acme.dnsChallenge.resolvers=1.1.1.1:53,8.8.8.8:53" | |
| - "--certificatesresolvers.le.acme.dnsChallenge.provider=cloudflare" | |
| - "--certificatesresolvers.le.acme.dnsChallenge.delayBeforeCheck=30" | |
| volumes: | |
| - /etc/localtime:/etc/localtime:ro | |
| - /etc/timezone:/etc/timezone:ro | |
| - /var/run/docker.sock:/var/run/docker.sock:ro | |
| - ./config/:/etc/traefik/config/:ro | |
| - ./ssl/:/data/ssl/ | |
| labels: | |
| - "traefik.enable=true" | |
| - "traefik.docker.network=traefik" | |
| - "traefik.http.routers.traefik-dash-web.tls.certresolver=le" | |
| - "traefik.http.routers.traefik-dash-web.tls.domains[0].main=company.ltd" | |
| - "traefik.http.routers.traefik-dash-web.tls.domains[0].sans=*.company.ltd" | |
| - "traefik.http.routers.traefik-dash-web.tls=true" | |
| - "traefik.http.routers.traefik-dash-web.middlewares=common-auth@file" | |
| - "traefik.http.routers.traefik-dash-web.entrypoints=https" | |
| - "traefik.http.routers.traefik-dash-web.rule=Host(`traefik.company.ltd`) && PathPrefix(`/`)" | |
| - "traefik.http.routers.traefik-dash-web.service=dashboard@internal" | |
| - "traefik.http.routers.traefik-dash-api.middlewares=common-auth@file" | |
| - "traefik.http.routers.traefik-dash-api.entrypoints=https" | |
| - "traefik.http.routers.traefik-dash-api.rule=Host(`traefik.company.ltd`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))" | |
| - "traefik.http.routers.traefik-dash-api.tls=true" | |
| - "traefik.http.routers.traefik-dash-api.service=api@internal" | |
| healthcheck: | |
| test: ["CMD-SHELL", "wget -q --spider --proxy off localhost:8080/ping || exit 1"] | |
| interval: 3s | |
| retries: 12 | |
| logging: | |
| driver: "json-file" | |
| options: | |
| max-size: "1m" | |
| networks: | |
| traefik: | |
| external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment