services:
  klz-app:
    build:
      context: .
      dockerfile: Dockerfile
      target: development
    volumes:
      - .:/app
      - /app/node_modules
      - /app/.next
    environment:
      - WATCHPACK_POLLING=true # Useful for Docker volume mounting issues on some systems
    restart: "no"
    container_name: klz-app-dev
    labels:
      - "traefik.enable=true"
      # Clear any production middlewares/headers redirect
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.middlewares="
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.rule=Host(`${TRAEFIK_HOST:-klz.localhost}`)"
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.entrypoints=web"
      # Configure main router for local HTTP without auth
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}.rule=Host(`${TRAEFIK_HOST:-klz.localhost}`)"
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}.entrypoints=web"
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}.middlewares="
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}.tls=false"
      - "traefik.docker.network=infra"

  directus-cms:
    container_name: klz-cms-dev
    restart: "no"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-cms.rule=Host(`${DIRECTUS_HOST:-cms.klz.localhost}`)"
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-cms.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
      - "traefik.http.routers.${PROJECT_NAME:-klz-cables}-cms.service=${PROJECT_NAME:-klz-cables}-cms"
      - "traefik.http.services.${PROJECT_NAME:-klz-cables}-cms.loadbalancer.server.port=8055"
      - "traefik.docker.network=infra"

  klz-db:
    restart: "no"

  gatekeeper:
    restart: "no"
