Skip to content

Instantly share code, notes, and snippets.

@dduportal
Created October 23, 2019 12:45
Show Gist options
  • Save dduportal/851ad722f6a0dd1f48c617f62f69637f to your computer and use it in GitHub Desktop.
Save dduportal/851ad722f6a0dd1f48c617f62f69637f to your computer and use it in GitHub Desktop.
version: '3'
services:
reverse-proxy:
image: traefik:v2.0
command:
- --providers.docker
- --entryPoints.web.address=:80
- --entryPoints.websecure.address=:443
- --api.dashboard=true
- --certificatesresolvers.basic.acme.tlschallenge=true
- --certificatesresolvers.basic.acme.email=${EMAIL}
- --certificatesResolvers.sample.acme.caServer="https://acme-staging-v02.api.letsencrypt.org/directory"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
# Secured Dashboard
- "traefik.http.routers.traefik.rule=Host(`${DOMAIN}`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.middlewares=dashboard-auth"
- "traefik.http.routers.traefik.tls.certresolver=basic"
- "traefik.http.middlewares.dashboard-auth.basicauth.users=admin:$$apr1$$KbuJwF8J$$sN1veijrt180SXpBEpn1F0"
# Global redirect http 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"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
webapp:
image: dduportal/webapp:traefik
labels:
- "traefik.http.routers.new-webapp-secure.rule=Host(`${DOMAIN}`)" #HTTPS
- "traefik.http.routers.new-webapp-secure.entrypoints=websecure"
- "traefik.http.routers.new-webapp-secure.tls.certresolver=basic"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment