version: "3"

services:
  fireshare:
    container_name: fireshare
    image: shaneisrael/fireshare:v1.2.20
    ports:
      - ${APP_PORT}:80
    volumes:
      - ${APP_DATA_DIR}/data/fireshare_data:/data
      - ${APP_DATA_DIR}/data/fireshare_processed:/processed
      - ${ROOT_FOLDER_HOST}/media/data/videos/fireshare_videos:/videos
    environment:
      - ADMIN_USERNAME=${FIRESHARE_USERNAME}
      - ADMIN_PASSWORD=${FIRESHARE_PASSWORD}
      - SECRET_KEY=${FIRESHARE_SECRET_KEY}
      - MINUTES_BETWEEN_VIDEO_SCANS=5
      - PUID=1000
      - PGID=1000
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.fireshare-web-redirect.redirectscheme.scheme: https
      traefik.http.services.fireshare.loadbalancer.server.port: 80
      # Web
      traefik.http.routers.fireshare-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.fireshare-insecure.entrypoints: web
      traefik.http.routers.fireshare-insecure.service: fireshare
      traefik.http.routers.fireshare-insecure.middlewares: fireshare-web-redirect
      # Websecure
      traefik.http.routers.fireshare.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.fireshare.entrypoints: websecure
      traefik.http.routers.fireshare.service: fireshare
      traefik.http.routers.fireshare.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.fireshare-local-insecure.rule: Host(`fireshare.${LOCAL_DOMAIN}`)
      traefik.http.routers.fireshare-local-insecure.entrypoints: web
      traefik.http.routers.fireshare-local-insecure.service: fireshare
      traefik.http.routers.fireshare-local-insecure.middlewares: fireshare-web-redirect
      # Local domain secure
      traefik.http.routers.fireshare-local.rule: Host(`fireshare.${LOCAL_DOMAIN}`)
      traefik.http.routers.fireshare-local.entrypoints: websecure
      traefik.http.routers.fireshare-local.service: fireshare
      traefik.http.routers.fireshare-local.tls: true
