version: "3.7"
services:
  filebrowser:
    container_name: filebrowser
    image: filebrowser/filebrowser:s6
    ports:
      - ${APP_PORT}:80
    volumes:
      - ${ROOT_FOLDER_HOST}/app-data:/srv/app-data
      - ${ROOT_FOLDER_HOST}/media:/srv/media
      - ${APP_DATA_DIR}/data/general:/srv/general
      - ${APP_DATA_DIR}/data/db:/database
      - ${APP_DATA_DIR}/data/config:/config
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.filebrowser-web-redirect.redirectscheme.scheme: https
      traefik.http.services.filebrowser.loadbalancer.server.port: 80
      # Web
      traefik.http.routers.filebrowser-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.filebrowser-insecure.entrypoints: web
      traefik.http.routers.filebrowser-insecure.service: filebrowser
      traefik.http.routers.filebrowser-insecure.middlewares: filebrowser-web-redirect
      # Websecure
      traefik.http.routers.filebrowser.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.filebrowser.entrypoints: websecure
      traefik.http.routers.filebrowser.service: filebrowser
      traefik.http.routers.filebrowser.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.filebrowser-local-insecure.rule: Host(`filebrowser.${LOCAL_DOMAIN}`)
      traefik.http.routers.filebrowser-local-insecure.entrypoints: web
      traefik.http.routers.filebrowser-local-insecure.service: filebrowser
      traefik.http.routers.filebrowser-local-insecure.middlewares: filebrowser-web-redirect
      # Local domain secure
      traefik.http.routers.filebrowser-local.rule: Host(`filebrowser.${LOCAL_DOMAIN}`)
      traefik.http.routers.filebrowser-local.entrypoints: websecure
      traefik.http.routers.filebrowser-local.service: filebrowser
      traefik.http.routers.filebrowser-local.tls: true
