version: "3.9"

services:
  mongodb:
    image: mongo:7
    container_name: mongodb
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: rootpassword
    command: >
      mongod --replSet rs0 --bind_ip 192.168.1.101,192.168.1.102,192.168.1.103,192.168.1.200 --auth
    ports:
      - "27017:27017"
    volumes:
      - mongo_data:/data/db
      - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: unless-stopped

volumes:
  mongo_data:

