Skip to content

Instantly share code, notes, and snippets.

@erikvullings
Created May 22, 2023 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikvullings/c8219a16be6577bd6bed7eb2280094d3 to your computer and use it in GitHub Desktop.
Save erikvullings/c8219a16be6577bd6bed7eb2280094d3 to your computer and use it in GitHub Desktop.
Traefik reverse proxy settings in Docker (swarm), including strip path prefix
---
version: "3.3"
networks:
icem-net:
driver: overlay
attachable: true
services:
reverse-proxy:
image: traefik:v2.4
command:
- "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--api.insecure=true"
networks:
- icem-net
ports:
- 3080:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
placement:
constraints: [node.role == manager]
t2v:
image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-multilingual-mpnet-base-v2
networks:
- icem-net
environment:
ENABLE_CUDA: "0"
deploy:
mode: replicated
replicas: 3
labels:
- traefik.enable=true
- traefik.http.services.t2v.loadbalancer.server.port=8080
- traefik.http.routers.t2v.rule=Host(`${HOST}`) && PathPrefix(`/t2v`)
- traefik.http.routers.t2v.middlewares=t2v-stripprefix
- traefik.http.middlewares.t2v-stripprefix.stripprefix.prefixes=/t2v
placement:
constraints: [node.role == worker]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment