Advertisement
tmsteinhardt

Traefik docker-compose.yml

May 13th, 2025 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. secrets:
  2. cf-token:
  3. file: ./cf-token
  4. services:
  5. traefik:
  6. image: traefik:latest
  7. container_name: traefik
  8. restart: unless-stopped
  9. security_opt:
  10. - no-new-privileges:true # helps to increase security
  11. secrets:
  12. - cf-token # the secret at the top of this file
  13. env_file:
  14. - .env # store other secrets e.g., dashboard password
  15. networks:
  16. proxy:
  17. ports:
  18. - 80:80
  19. - 443:443
  20. environment:
  21. - TRAEFIK_DASHBOARD_CREDENTIALS=${TRAEFIK_DASHBOARD_CREDENTIALS}
  22. # - [email protected] # Cloudflare email
  23. # - CF_DNS_API_TOKEN=YOUR-TOKEN # Cloudflare API Token
  24. - CF_DNS_API_TOKEN_FILE=/run/secrets/cf-token # see https://doc.traefik.io/traefik/https/acme/#providers
  25. volumes:
  26. - /etc/localtime:/etc/localtime:ro
  27. - /var/run/docker.sock:/var/run/docker.sock:ro
  28. - /traefik/docker/traefik.yml:/traefik.yaml:ro
  29. - /traefik/docker/acme.json:/acme.json
  30. - /traefik/config.yml:/config.yml:ro
  31. - /traefik/docker/logs:/var/log/traefik
  32. labels:
  33. - "traefik.enable=true"
  34. - "traefik.http.routers.traefik.entrypoints=http"
  35. - "traefik.http.routers.traefik.rule=Host(`traefik.steinhardt0620.xyz`)"
  36. - "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_DASHBOARD_CREDENTIALS}"
  37. - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
  38. - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
  39. - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
  40. - "traefik.http.routers.traefik-secure.entrypoints=https"
  41. - "traefik.http.routers.traefik-secure.rule=Host(`traefik.steinhardt0620.xyz`)"
  42. - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
  43. - "traefik.http.routers.traefik-secure.tls=true"
  44. - "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
  45. - "traefik.http.routers.traefik-secure.tls.domains[0].main=steinhardt0620.xyz"
  46. - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.steinhardt0620.xyz"
  47. - "traefik.http.routers.traefik-secure.service=api@internal"
  48.  
  49. networks:
  50. proxy:
  51. external: true # or comment this line to auto create the network
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement