Ajouter traefik/docker-compose.yml

This commit is contained in:
Lecourt Dimitri 2024-10-06 08:28:13 +02:00
parent c7b9c3f74b
commit aa19f3e02b

View file

@ -0,0 +1,61 @@
name: traefik
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
restart: always
environment:
- OVH_ENDPOINT=${OVH_ENDPOINT}
- OVH_APPLICATION_KEY=${OVH_APPLICATION_KEY}
- OVH_APPLICATION_SECRET=${OVH_APPLICATION_SECRET}
- OVH_CONSUMER_KEY=${OVH_CONSUMER_KEY}
ports:
- "80:80"
- "443:443"
- "3478:3478/udp"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik-conf.yml:/traefik.yml:ro"
- "./acme.json:/acme.json"
- "./letsencrypt:/letsencrypt"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`${TRAEFIK_URL}`)"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.routers.traefik-dashboard.rule=Host(`${DASHBOARD_URL}`)"
- "traefik.http.routers.traefik-dashboard.service=api@internal"
- "traefik.http.routers.traefik-dashboard.entrypoints=websecure"
- "traefik.http.routers.traefik-dashboard.tls=true"
- "traefik.http.routers.traefik-dashboard.tls.certresolver=letsencrypt"
- "traefik.http.routers.traefik-dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=${AUTH_USER}:${AUTH_PASS}"
- homepage.group=Work
- homepage.name=Traefik
- homepage.href=<url of your dashbord>
- homepage.description=Dashboard Traefik
- homepage.icon=traefik.png
networks:
- web
whoami:
image: containous/whoami
container_name: whoami
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`${TRAEFIK_URL}`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls=true"
- "traefik.http.routers.whoami.tls.certresolver=letsencrypt"
networks:
- web
networks:
web:
external: true