-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-compose.yml
33 lines (32 loc) · 1.6 KB
/
docker-compose.yml
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
version: "3.7"
services:
docs-prod:
build:
context: .
dockerfile: Dockerfile.Prod
networks:
- traefik_proxy
restart: unless-stopped
labels:
## traefik basic config
- "traefik.enable=true"
- "traefik.http.routers.docs-prod.rule=(Host(`mydomain.tld`) && PathPrefix(`/docs`)) || (Host(`mydomain.test`) && PathPrefix(`/docs`))"
### set tls
- "traefik.http.routers.docs-prod.tls=true"
- "traefik.http.routers.docs-prod.tls.certresolver=le"
### strip prefix and add missing trailing slash
- "traefik.http.middlewares.docs-prod-stripprefix.chain.middlewares=docs-prod-stripprefix-1,docs-prod-stripprefix-2"
- "traefik.http.middlewares.docs-prod-stripprefix-1.redirectregex.regex=^(https?://[^/]+/[a-z0-9_]+)$$"
- "traefik.http.middlewares.docs-prod-stripprefix-1.redirectregex.replacement=$${1}/"
- "traefik.http.middlewares.docs-prod-stripprefix-1.redirectregex.permanent=true"
- "traefik.http.middlewares.docs-prod-stripprefix-2.stripprefixregex.regex=/[a-z0-9_]+"
### basic auth
# Note: when used in docker-compose.yml all dollar signs in the hash need to be doubled for escaping.
# To create user:password pair, it's possible to use this command:
# echo $(htpasswd -nB user) | sed -e s/\\$/\\$\\$/g
- "traefik.http.middlewares.docs-prod-basic-auth.basicauth.users=user:$$2y$$05$$ruGI.Haez/QvDIPsQ4zzz.rNowaU1Gc05rhR3jfkzzWp01L.EL4GO"
#### middlewares
- "traefik.http.routers.docs-prod.middlewares=docs-prod-stripprefix,docs-prod-basic-auth"
networks:
traefik_proxy:
external: true