services:
  tidaldb:
    build:
      context: ..
      dockerfile: docker/standalone/Dockerfile
    ports:
      - "9400:9400"
      - "9091:9091"
    environment:
      - TIDAL_API_KEY=${TIDAL_API_KEY}
      - TIDAL_SERVER_LOG=info
    volumes:
      # Matches the standalone image's `VOLUME ["/data"]` + `--data-dir /data`.
      # Mounting anywhere else leaves the data dir on the ephemeral container
      # layer and loses every write on restart.
      - tidaldb-data:/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "-H", "Authorization: Bearer ${TIDAL_API_KEY}", "http://localhost:9400/health"]
      interval: 30s
      timeout: 5s
      retries: 3

  prometheus:
    image: prom/prometheus:v2.53.0
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
    depends_on:
      - tidaldb

volumes:
  tidaldb-data:
