Files
docker-compose-cookbooks/traefik/docker-compose.yml
T
nick 206ed58eb9 Cleaned up all compose files
cleaned up all the files.
they should now all work for multiple projects.
2020-04-16 21:13:59 -07:00

47 lines
1.5 KiB
YAML

###############################################################################
# Traefik
#
# Should only need one instance of this.
# Make sure the .env file is updated
# docker-compose up -d
###############################################################################
version: '3.3'
networks:
${NETWORK_NAME}:
driver: bridge
services:
traefik:
# https://hub.docker.com/_/traefik
image: "traefik:${TRAEFIK_V}"
container_name: "traefik"
restart: unless-stopped
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --api
- --providers.docker
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- ${NETWORK_NAME}
labels:
# Dashboard
- "traefik.http.routers.traefik.rule=Host(`${DOMAIN_NAME}`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.tls.certresolver=leresolver"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.middlewares=authtraefik"
- "traefik.http.middlewares.authtraefik.basicauth.users=${TRAEFIK_USER}:${TRAEFIK_PASS}"
# global redirect to 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"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"