first commit

This commit is contained in:
1-h
2024-08-30 15:31:07 +08:00
commit daab4851ed
4 changed files with 58 additions and 0 deletions

17
Caddyfile Normal file
View File

@ -0,0 +1,17 @@
:80 {
route /whoami {
# https://acouvreur.github.io/sablier/#/plugins/caddy?id=configuration
sablier http://sablier:10000 {
group demo
session_duration 5s
dynamic {
display_name My Whoami Service
show_details on
theme shuffle # https://acouvreur.github.io/sablier/#/themes?id=themes
refresh_frequency 1s
}
}
reverse_proxy whoami:80
}
}

View File

@ -0,0 +1,12 @@
ARG CADDY_VERSION=2
ARG SABLIER_VERSION=v1.7.0
FROM caddy:${CADDY_VERSION}-builder AS builder
ADD https://github.com/acouvreur/sablier.git#${SABLIER_VERSION} /sablier
RUN xcaddy build \
--with github.com/acouvreur/sablier/plugins/caddy=/sablier/plugins/caddy
FROM caddy:${CADDY_VERSION}
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

6
README.md Normal file
View File

@ -0,0 +1,6 @@
# sablier-example
```
docker compose create
docker compose up -d sablier proxy
curl http://localhost:8080/whoami; echo -e "\n等待启动完成"; sleep 3; curl http://localhost:8080/whoami;
```

23
compose.yml Normal file
View File

@ -0,0 +1,23 @@
services:
proxy:
build:
dockerfile: Dockerfile.caddy-with-sablier
ports:
- "8080:80"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
# http://150.230.239.12:8080/whoami
whoami:
image: containous/whoami
labels:
- sablier.enable=true
- sablier.group=demo
sablier:
image: acouvreur/sablier:1.7.0
command:
- start
- --provider.name=docker
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'