services:
  webpage1:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: ikfreunde-webpage1
    volumes:
      - /srv/ikfreunde/webpage1/ikfreunde.com.html:/app/ikfreunde.com.html
      - /srv/ikfreunde/webpage1/site-content.de.json:/app/content/site-content.de.json
    restart: unless-stopped
    networks:
      - proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.webpage1.rule=Host(`mydomain.de`) && PathPrefix(`/webpage1`)
      - traefik.http.routers.webpage1.entrypoints=websecure
      - traefik.http.routers.webpage1.tls=true
      - traefik.http.services.webpage1.loadbalancer.server.port=4173
      - traefik.http.routers.webpage1.middlewares=webpage1-slash,webpage1-strip
      - traefik.http.middlewares.webpage1-slash.redirectregex.regex=^https?://([^/]+)/webpage1$
      - traefik.http.middlewares.webpage1-slash.redirectregex.replacement=https://$${1}/webpage1/
      - traefik.http.middlewares.webpage1-slash.redirectregex.permanent=true
      - traefik.http.middlewares.webpage1-strip.stripprefix.prefixes=/webpage1

  webpage2:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: ikfreunde-webpage2
    volumes:
      - /srv/ikfreunde/webpage2/ikfreunde.com.html:/app/ikfreunde.com.html
      - /srv/ikfreunde/webpage2/site-content.de.json:/app/content/site-content.de.json
    restart: unless-stopped
    networks:
      - proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.webpage2.rule=Host(`mydomain.de`) && PathPrefix(`/webpage2`)
      - traefik.http.routers.webpage2.entrypoints=websecure
      - traefik.http.routers.webpage2.tls=true
      - traefik.http.services.webpage2.loadbalancer.server.port=4173
      - traefik.http.routers.webpage2.middlewares=webpage2-slash,webpage2-strip
      - traefik.http.middlewares.webpage2-slash.redirectregex.regex=^https?://([^/]+)/webpage2$
      - traefik.http.middlewares.webpage2-slash.redirectregex.replacement=https://$${1}/webpage2/
      - traefik.http.middlewares.webpage2-slash.redirectregex.permanent=true
      - traefik.http.middlewares.webpage2-strip.stripprefix.prefixes=/webpage2

  webpage3:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: ikfreunde-webpage3
    volumes:
      - /srv/ikfreunde/webpage3/ikfreunde.com.html:/app/ikfreunde.com.html
      - /srv/ikfreunde/webpage3/site-content.de.json:/app/content/site-content.de.json
    restart: unless-stopped
    networks:
      - proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.webpage3.rule=Host(`mydomain.de`) && PathPrefix(`/webpage3`)
      - traefik.http.routers.webpage3.entrypoints=websecure
      - traefik.http.routers.webpage3.tls=true
      - traefik.http.services.webpage3.loadbalancer.server.port=4173
      - traefik.http.routers.webpage3.middlewares=webpage3-slash,webpage3-strip
      - traefik.http.middlewares.webpage3-slash.redirectregex.regex=^https?://([^/]+)/webpage3$
      - traefik.http.middlewares.webpage3-slash.redirectregex.replacement=https://$${1}/webpage3/
      - traefik.http.middlewares.webpage3-slash.redirectregex.permanent=true
      - traefik.http.middlewares.webpage3-strip.stripprefix.prefixes=/webpage3

networks:
  proxy:
    external: true
