# e2e/docker-compose.yml from repo
# https://github.com/bahmutov/cypress-open-from-docker-compose
version: '3.8'
services:
  app:
    build:
      context: ./
      dockerfile: Dockerfile 
    logging:
      options:
        max-size: '12m'
        max-file: '5'
      driver: json-file
    labels:
      - traefik.enable=true
      - traefik.http.routers.render-file${USER_ID:-1}.rule=Host(`${URL_CARBONE}`)
      - traefik.http.routers.render-file${USER_ID:-1}.entrypoints=websecure
      - traefik.http.routers.render-file${USER_ID:-1}.tls=true
      - traefik.http.routers.render-file${USER_ID:-1}.tls.certresolver=lets-encrypt
      - traefik.http.services.render-file${USER_ID:-1}.loadbalancer.server.port=4000
    networks:
      - traefik-proxy
    volumes:
      - templatefiles:/app/templates
  
  filebrowser:
    image: filebrowser/filebrowser:latest
    volumes:
      - templatefiles:/srv  
      - ./database.db:/database.db
    labels:
      - traefik.enable=true
      - traefik.http.routers.filebrowser-carbo${USER_ID:-1}.rule=Host(`file.${URL_CARBONE}`)
      - traefik.http.routers.filebrowser-carbo${USER_ID:-1}.entrypoints=websecure
      - traefik.http.routers.filebrowser-carbo${USER_ID:-1}.tls=true
      - traefik.http.routers.filebrowser-carbo${USER_ID:-1}.tls.certresolver=lets-encrypt
      - traefik.http.services.filebrowser-carbo${USER_ID:-1}.loadbalancer.server.port=80
      - traefik.docker.network=${NETWORK_TRAEFIK}
    restart: unless-stopped
    networks:
      - traefik-proxy

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

volumes:      
  templatefiles:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_TEMPLATES}
      o: bind
