version: "3.7"
services:
  privatebin:
    image: privatebin/nginx-fpm-alpine:1.7.1
    container_name: privatebin
    dns:
      - ${DNS_IP}
    ports:
      - ${APP_PORT}:8080
    restart: unless-stopped
    networks:
      - tipi_main_network
    volumes:
      - ${APP_DATA_DIR}/data:/srv/data
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.privatebin-web-redirect.redirectscheme.scheme: https
      traefik.http.services.privatebin.loadbalancer.server.port: 8080
      # Web
      traefik.http.routers.privatebin-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.privatebin-insecure.entrypoints: web
      traefik.http.routers.privatebin-insecure.service: privatebin
      traefik.http.routers.privatebin-insecure.middlewares: privatebin-web-redirect
      # Websecure
      traefik.http.routers.privatebin.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.privatebin.entrypoints: websecure
      traefik.http.routers.privatebin.service: privatebin
      traefik.http.routers.privatebin.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.privatebin-local-insecure.rule: Host(`privatebin.${LOCAL_DOMAIN}`)
      traefik.http.routers.privatebin-local-insecure.entrypoints: web
      traefik.http.routers.privatebin-local-insecure.service: privatebin
      traefik.http.routers.privatebin-local-insecure.middlewares: privatebin-web-redirect
      # Local domain secure
      traefik.http.routers.privatebin-local.rule: Host(`privatebin.${LOCAL_DOMAIN}`)
      traefik.http.routers.privatebin-local.entrypoints: websecure
      traefik.http.routers.privatebin-local.service: privatebin
      traefik.http.routers.privatebin-local.tls: true