A slight rethink...

This commit is contained in:
mifi committed 2026-12-03 19:52:36 -03:00
1 parent c5654fc0c5
commit 1ec52f0a75
4 files changed
+195 -108

No files matched your search

+56 -36
View File
@@ -1,19 +1,50 @@
services:
traefik:
image: traefik:latest
image: ${TRAEFIK_IMAGE:-traefik:latest}
container_name: traefik
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
- "host.docker.internal:host-gateway"
command:
- --configFile=/etc/traefik/traefik.yaml
volumes:
- ${TRAEFIK_YAML:-./traefik/traefik.yaml}:/etc/traefik/traefik.yaml
- ${TRAEFIK_CONFD:-./traefik/conf.d}:/etc/traefik/conf.d
- traefik-acme:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock
- type: bind
source: ${TRAEFIK_ACME:?TRAEFIK_ACME must be set}
target: /letsencrypt
read_only: false
bind:
create_host_path: false
- type: bind
source: ${TRAEFIK_YAML:-./traefik/traefik.yaml}
target: /etc/traefik/traefik.yaml
read_only: true
bind:
create_host_path: false
- type: bind
source: ${TRAEFIK_CONFD:-./traefik/conf.d}
target: /etc/traefik/conf.d
read_only: true
bind:
create_host_path: false
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
bind:
create_host_path: false
networks:
- docknet
- proxy
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=${NETWORK_NAME:-docknet}'
- 'traefik.http.routers.api.rule=Host(`${CONSOLE_HOST}`)'
- 'traefik.http.routers.api.entrypoints=websecure'
- 'traefik.http.routers.api.service=api@internal'
@@ -21,42 +52,31 @@ services:
- 'traefik.http.routers.api.tls.certresolver=letsencrypt'
- 'traefik.http.routers.api.middlewares=traefik-auth'
- 'traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_CONSOLE_AUTH}'
ports:
- 8342:80
- 8767:443
- 8080:8080
- "${TRAEFIK_HTTP_PORT:-8342}:80"
- "${TRAEFIK_HTTPS_PORT:-8767}:443"
- "${TRAEFIK_DASHBOARD_PORT:-8080}:8080"
environment:
- CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
- CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
command:
- --api
# Enable the Trafik dashboard
- --api.dashboard=true
# Tell Traefik to discover containers using the Docker API
- --providers.docker=true
- --providers.docker.exposedByDefault=false
# Set up LetsEncrypt
- --certificatesresolvers.letsencrypt.acme.dnschallenge=true
- --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.letsencrypt.acme.email=${CLOUDFLARE_EMAIL}
# Set up an insecure listener that redirects all traffic to TLS
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.websecure.address=:443
# Set up the TLS configuration for our websecure listener
- --entrypoints.websecure.http.tls=true
- --entrypoints.websecure.http.tls.certResolver=letsencrypt
- --log=true
- --log.level=INFO
healthcheck:
test: [ "CMD", "traefik", "healthcheck", "--ping" ]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
logging:
driver: "json-file"
driver: json-file
options:
max-size: "1m"
max-file: "3"
compress: "true"
networks:
docknet:
proxy:
name: ${NETWORK_NAME:-docknet}
volumes:
traefik-acme:
external: true