version: "3.8"
services:
  nginx-web:
    image : nginx
    restart: always
    volumes:
      - ./data:/var/www/html
      - ./conf:/etc/nginx/conf.d/
    networks:
      - traefik-proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.nginx-web${USER_ID:-1}.rule=Host(`${URL_PWA}`) 
      - traefik.http.routers.nginx-web${USER_ID:-1}.entrypoints=websecure
      - traefik.http.routers.nginx-web${USER_ID:-1}.tls=true
      - traefik.http.routers.nginx-web${USER_ID:-1}.tls.certresolver=lets-encrypt
      - traefik.http.services.nginx-web${USER_ID:-1}.loadbalancer.server.port=80

  filebrowser:
    image: filebrowser/filebrowser:latest
    volumes:
      - ./data:/srv
    labels:
      - traefik.enable=true
      - traefik.http.routers.filebrowser-nginx${USER_ID:-1}.rule=Host(`file.${URL_PWA}`)
      - traefik.http.routers.filebrowser-nginx${USER_ID:-1}.entrypoints=websecure
      - traefik.http.routers.filebrowser-nginx${USER_ID:-1}.tls=true
      - traefik.http.routers.filebrowser-nginx${USER_ID:-1}.tls.certresolver=lets-encrypt
      - traefik.http.services.filebrowser-nginx${USER_ID:-1}.loadbalancer.server.port=80
      - traefik.docker.network=${NETWORK_TRAEFIK}
    networks:
      - traefik-proxy

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