-
Notifications
You must be signed in to change notification settings - Fork 12
/
example-service-docker-compose.yml
36 lines (27 loc) · 1.2 KB
/
example-service-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
34
35
36
########################################################
# example docker compose file for swarm mode
#########################################################
version: "3.9"
networks:
traefik-public:
external: true
services:
my-service:
image: MY_DOCKER_IMAGE
networks:
- traefik-public
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.my-service.rule=Host(`my-domain.com`, `www.my-domain.com`)"
- "traefik.http.routers.my-service.entrypoints=http"
- "traefik.http.routers.my-service.middlewares=https-redirect"
- "traefik.http.routers.my-service-https.rule=Host(`my-domain.com`, `www.my-domain.com`)"
- "traefik.http.routers.my-service-https.entrypoints=https"
# force redirect to www
- "traefik.http.routers.my-service-https.middlewares=non-www-to-www"
- "traefik.http.routers.my-service-https.tls=true"
- "traefik.http.routers.my-service-https.tls.certresolver=le"
- "traefik.docker.network=traefik-public"
- "traefik.constraint-label=traefik-public"
- "traefik.http.services.my-service-https.loadbalancer.server.port=80"