Skip to content

Instantly share code, notes, and snippets.

@numpde
Last active October 11, 2024 15:45
Show Gist options
  • Save numpde/ecfa3ff8c2a0fbc5e3b20b9626a394de to your computer and use it in GitHub Desktop.
Save numpde/ecfa3ff8c2a0fbc5e3b20b9626a394de to your computer and use it in GitHub Desktop.
WP/WC: Traefik
services:
traefik:
image: traefik:v3.1.4
container_name: traefik
restart: always
command:
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.dashboard.address=:8080"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--certificatesresolvers.le.acme.email=${ACME_EMAIL}"
- "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
- "--certificatesresolvers.le.acme.tlschallenge=true"
- "--log.level=DEBUG"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
networks:
- ecommerce
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik-dashboard.rule=Host(`${TRAEFIK_DASHBOARD_DOMAIN}`)"
- "traefik.http.routers.traefik-dashboard.service=api@internal"
- "traefik.http.routers.traefik-dashboard.rule=Host(`${TRAEFIK_DASHBOARD_DOMAIN}`)"
- "traefik.http.routers.traefik-dashboard.entrypoints=websecure"
- "traefik.http.routers.traefik-dashboard.tls.certresolver=le"
- "traefik.http.routers.traefik-dashboard.middlewares=traefik-auth"
- "traefik.http.middlewares.traefik-auth.basicauth.users=${BASIC_AUTH_USER}:${BASIC_AUTH_PASSWORD_HASH}"
whoami:
image: traefik/whoami
container_name: whoami
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`${WHOAMI_DOMAIN}`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=le"
- "traefik.http.routers.whoami.middlewares=traefik-auth"
networks:
- ecommerce
depends_on:
- traefik
networks:
ecommerce:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment