services:
  boardmate-api:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: boardmate-api
    ports:
      - "8000:8080"
      - "5005:5005"
    environment:
      SPRING_DATA_MONGODB_URI: "mongodb://board-mate-user:apx820kcng@mongodb:27017/board-mate-db"
      JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
    depends_on:
      - mongodb
      - elasticsearch
    volumes:
      - ./.gradle:/home/gradle/.gradle # Use your existing local Gradle and build directories
      - ./build:/app/.gradle           # optional, only if you want project cache mapped too

  elasticsearch:
    image: 'docker.elastic.co/elasticsearch/elasticsearch:7.17.10'
    environment:
      - 'ELASTIC_PASSWORD=secret'
      - 'discovery.type=single-node'
      - 'xpack.security.enabled=false'
    ports:
      - '8100:9200'
      - '8101:9300'
  grafana-lgtm:
    image: 'grafana/otel-lgtm:latest'
    ports:
      - '8200:3000'
      - '8201:4317'
      - '8202:4318'
  prometheus:
    image: 'prom/prometheus:latest'
    container_name: prometheus
    ports:
      - "8300:9090"
    volumes:
      - ./prometheus.yaml:/etc/prometheus/prometheus.yml

  mongodb:
    image: mongo:latest
    environment:
      - MONGO_INITDB_DATABASE=board-mate-db
      - MONGO_INITDB_ROOT_PASSWORD=secret
      - MONGO_INITDB_ROOT_USERNAME=root
    ports:
      - "8400:27017"
    volumes:
      - ./mongo-data:/data/db
      - ./mongo-init:/docker-entrypoint-initdb.d
  #mongo-express:
  #  image: mongo-express:latest
  #  depends_on:
  #   - mongodb
  #  ports:
  #    - "8401:8081"
  #  environment:
  #    - ME_CONFIG_MONGODB_SERVER=mongodb
  #    - ME_CONFIG_MONGODB_PORT=27017
  #    - ME_CONFIG_MONGODB_ADMINUSERNAME=root
  #    - ME_CONFIG_MONGODB_ADMINPASSWORD=secret
  #    - ME_CONFIG_MONGODB_AUTH_DATABASE=admin