Skip to content

Instantly share code, notes, and snippets.

@alinz
Forked from nknapp/Dockerfile
Created December 13, 2017 21:46
Show Gist options
  • Select an option

  • Save alinz/5ad821ac78ab84d3ee2969cac6affc56 to your computer and use it in GitHub Desktop.

Select an option

Save alinz/5ad821ac78ab84d3ee2969cac6affc56 to your computer and use it in GitHub Desktop.

Revisions

  1. @nknapp nknapp created this gist Oct 30, 2016.
    5 changes: 5 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    FROM traefik:camembert
    ADD traefik.toml .
    EXPOSE 80
    EXPOSE 8080
    EXPOSE 443
    19 changes: 19 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    version: '2'

    services:
    traefik:
    build: .
    # command: --logLevel=DEBUG
    ports:
    - "80:80"
    - "443:443"
    - "127.0.0.1:8080:8080"
    restart: always
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    networks:
    - default
    cap_drop:
    - all
    cap_add:
    - net_bind_service
    37 changes: 37 additions & 0 deletions traefik.toml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    # defaultEntryPoints must be at the top because it should not be in any table below
    defaultEntryPoints = ["http", "https"]

    [web]
    # Port for the status page
    address = ":8080"

    # Entrypoints, http and https
    [entryPoints]

    # http should be redirected to https
    [entryPoints.http]
    address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"

    # https is the default
    [entryPoints.https]
    address = ":443"
    [entryPoints.https.tls]

    # Enable ACME (Let's Encrypt): automatic SSL
    [acme]
    # caServer = "https://acme-staging.api.letsencrypt.org/directory"
    email = "letsencrypt@example.com"
    storage = "acme.json" # or "traefik/acme/account" if using KV store
    entryPoint = "https"
    onDemand = false
    OnHostRule = true


    [docker]
    endpoint = "unix:///var/run/docker.sock"
    domain = "example.com"
    watch = true
    exposedbydefault = false