-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml.jsonnet
47 lines (44 loc) · 2.06 KB
/
docker-compose.yml.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local ddb = import 'ddb.docker.libjsonnet';
local pp = std.extVar("jsonnet.docker.expose.port_prefix");
local compose_network_name = std.extVar("docker.compose.network_name");
local domain_ext = std.extVar("core.domain.ext");
local domain_sub = std.extVar("core.domain.sub");
local domain = std.join('.', [domain_sub, domain_ext]);
ddb.Compose() {
services: {
traefik: ddb.Image("traefik:2.11") + {
container_name: "traefik",
ports+: [
"80:80",
"443:443"
],
networks+: [
"default",
"reverse-proxy"
],
labels+: {
"traefik.enable": true,
"traefik.http.routers.traefik-dashboard.rule": "Host(`" + domain + "`)",
"traefik.http.routers.traefik-dashboard.service": "api@internal",
"traefik.http.routers.traefik-dashboard-localhost.rule": "Host(`localhost`, `127.0.0.1`)",
"traefik.http.routers.traefik-dashboard-localhost.service": "api@internal",
"ddb.emit.certs:generate[localhost]": "localhost",
"ddb.emit.certs:generate[127.0.0.1]": "127.0.0.1",
"traefik.http.routers.traefik-dashboard-tls.rule": "Host(`" + domain + "`)",
"traefik.http.routers.traefik-dashboard-tls.service": "api@internal",
"traefik.http.routers.traefik-dashboard-tls.tls": true,
"traefik.http.routers.traefik-dashboard-tls-localhost.rule": "Host(`localhost`, `127.0.0.1`)",
"traefik.http.routers.traefik-dashboard-tls-localhost.service" :"api@internal",
"traefik.http.routers.traefik-dashboard-tls-localhost.tls": "true"
} + ddb.TraefikCertLabels(domain, "traefik-dashboard-tls"),
volumes+: [
"/var/run/docker.sock:/var/run/docker.sock",
ddb.path.project + "/.docker/.ca-certificates:/ca-certs",
ddb.path.project + "/traefik.toml:/traefik.toml",
ddb.path.project + "/acme.json:/acme.json",
ddb.path.project + "/config:/config",
ddb.path.home + "/certs:/certs"
]
}
}
}