This commit is contained in:
1-h
2024-09-03 12:23:54 +08:00
commit 5994020cb2
3 changed files with 51 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
acme.json

15
compose.whoami.yml Normal file
View File

@ -0,0 +1,15 @@
################################################################
# docker compose -f compose.whoami.yml up -d
################################################################
version: "3"
services:
# docker compose up -d --scale whoami=2
whoami:
# A container that exposes an API to show its IP address
image: traefik/whoami
labels:
- traefik.http.routers.whoami.rule=Host(`whoami.traefik-example.oo1.dev`)
- traefik.http.routers.whoami.tls=true
- traefik.http.routers.whoami.tls.certresolver=myresolver

35
compose.yml Normal file
View File

@ -0,0 +1,35 @@
################################################################
# https://doc.traefik.io/traefik/getting-started/quick-start/
# https://github.com/chudaozhe/traefik-samples/blob/main/docker-compose.yml
################################################################
version: "3"
services:
traefik-reverse-proxy:
# The official v3 Traefik docker image
image: traefik:v3.1
command:
# Enables the web UI and tells Traefik to listen to docker
- --api.insecure=true
- --providers.docker
- --entryPoints.web.address=:80
- --entryPoints.websecure.address=:443
# https://doc.traefik.io/traefik/https/acme/
- --certificatesresolvers.myresolver.acme.email=i@oo1.dev
- --certificatesresolvers.myresolver.acme.storage=acme.json
# used during the challenge
- --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./acme.json:/acme.json # chmod 600 ./acme.json
# environment: # https://doc.traefik.io/traefik/reference/static-configuration/env/