version: "3"

services:
  homer:
    image: b4bz/homer:latest
    restart: always
    volumes:
      - datahomer:/www/assets
    environment:
      - UID=1
      - GID=1
    labels:
      - traefik.enable=true
      - traefik.http.routers.homer.rule=Host(`${URL_DASH}`)
      - traefik.http.routers.homer.entrypoints=websecure
      - traefik.http.routers.homer.tls=true
      - traefik.http.routers.homer.tls.certresolver=lets-encrypt
      - traefik.http.routers.homer.middlewares=homer-auth
      - "traefik.http.middlewares.homer-auth.basicauth.users=admin:$$apr1$$cYDhyCjO$$PcbpRqtxLwPogxmSwc7u11"
      - traefik.http.routers.homer.service=homer-srv
      - traefik.http.services.homer-srv.loadbalancer.server.port=8080
      - traefik.docker.network=${NETWORK_TRAEFIK}
    networks:
      - traefik-proxy

  filebrowser:
    container_name: filebrowser
    image: filebrowser/filebrowser:latest
    volumes:
      - datahomer:/srv  # Arborescence qui sera visible de l'utilisateur par défaut
      - ./database.db:/database.db
    labels:
      - traefik.enable=true
      - traefik.http.routers.filebrowser.rule=Host(`${URL_FILEBROSWER}`)
      - traefik.http.routers.filebrowser.entrypoints=websecure
      - traefik.http.routers.filebrowser.tls=true
      - traefik.http.routers.filebrowser.tls.certresolver=lets-encrypt
      - traefik.http.routers.filebrowser.service=filebrowser-srv
      - traefik.http.services.filebrowser-srv.loadbalancer.server.port=80
      - traefik.docker.network=${NETWORK_TRAEFIK}
    restart: unless-stopped
    networks:
      - traefik-proxy

networks:
  traefik-proxy:
    external:
      name: ${NETWORK_TRAEFIK}

volumes:
 datahomer:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_DATA_HOMER}
      o: bind

 datafilebro:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_DATA_FILEBRO}
      o: bind

