---
services:
  web:
    build:
      dockerfile: Dockerfile
      args:
        userid: ${USE_UID:-10001}
        groupid: ${USE_GID:-10001}
    ports:
      - 8000:8000
    environment:
      OTEL_COLLECTOR_ENDPOINT: otel-collector:4317
    depends_on:
      - otel-collector
    develop:
      watch:
        - path: ./app
          action: rebuild

  otel-collector:
    image: otel/opentelemetry-collector-contrib
    command: --config=/etc/otelcol-config.yaml
    ports:
      - 8888:8888  # Prometheus metrics exposed by the Collector
      - 8889:8889  # Prometheus exporter metrics
      - 4317:4317  # OTLP gRPC receiver
      - 4318:4318  # OTLP http receiver
    volumes:
      - type: bind
        source: ./collector-config.yaml
        target: /etc/otelcol-config.yaml
    develop:
      watch:
        - path: ./collector-config.yaml
          target: /etc/otelcol-config.yaml
          action: sync+restart
