traefik/docker-compose.yml

36 lines
1.2 KiB
YAML
Raw Normal View History

2024-01-17 06:19:25 +01:00
version: "3.9"
2023-11-24 17:46:05 +01:00
networks:
default:
name: "${TRAEFIK_NETWORK}"
external: true
services:
traefik:
image: "traefik:latest"
container_name: "${PROJECT_NAME}_traefik"
hostname: "${PROJECT_NAME}"
network_mode: "host"
restart: "unless-stopped"
volumes:
- "./traefik.yml:/traefik.yml:ro"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./tls.yml:/etc/traefik/dynamic_conf/conf.yml:ro"
2023-12-05 11:41:04 +01:00
- "./acme.json:/certificates/acme.json"
2023-11-24 17:46:05 +01:00
- "./tls-data:/tls:ro"
labels:
- "traefik.enable=true"
- "traefik.docker.network=${TRAEFIK_NETWORK}"
# HTTP -> HTTPS
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.rule=HostRegexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# HTTPS Routers
- "traefik.http.routers.${PROJECT_NAME}_traefik.rule=Host(`${PROJECT_URL}`)"
- "traefik.http.services.${PROJECT_NAME}_traefik.loadbalancer.server.port=8080"
- "traefik.http.routers.${PROJECT_NAME}_traefik.tls=true"
2024-01-17 06:19:25 +01:00
- "traefik.http.routers.${PROJECT_NAME}_traefik.entrypoints=websecure"