services:

  mongo:
    image: mongo:5.0.14
    restart: "no"
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_DATABASE: cu
    volumes:
      - ./mongo_data:/data/db
      - ./mongo_init_scripts:/docker-entrypoint-initdb.d
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongo mongo:27017/test --quiet
      interval: 5s
      timeout: 5s
      retries: 5
      start_period: 40s

  mongo-express:
    image: mongo-express:1.0.0
    restart: "no"
    depends_on:
      mongo:
        condition: service_healthy
    ports:
      - "8081:8081"
    environment:
      ME_CONFIG_MONGODB_URL: mongodb://mongo:27017/
      ME_CONFIG_BASICAUTH_USERNAME: ""
      ME_CONFIG_BASICAUTH_PASSWORD: ""
    healthcheck:
      test: "wget -O - 127.0.0.1:8081"
      interval: 5s
      timeout: 5s
      retries: 5
      start_period: 5s