version: '3'
services:
  mongo-rs0-1:
    image: "mongo-start"
    build: ./mongo-rs0-1
    ports:
      - "27018:27017"
    networks:
      app_net:
        ipv4_address: 172.18.18.11

    volumes:
      - ./mongo-rs0-1/data:/data/db
    depends_on:
      - "mongo-rs0-2"
      - "mongo-rs0-3"

  mongo-rs0-2:
    image: "mongo"
    command: --replSet rs0 --smallfiles --oplogSize 128
    ports:
      - "27019:27017"
    networks:
      app_net:
        ipv4_address: 172.18.18.12
    volumes:
      - ./mongo-rs0-2/data:/data/db

  mongo-rs0-3:
    image: "mongo"
    command: --replSet rs0 --smallfiles --oplogSize 128
    ports:
      - "27020:27017"
    networks:
      app_net:
        ipv4_address: 172.18.18.13
    volumes:
      - ./mongo-rs0-3/data:/data/db

  redis:
    image: 'redis:latest'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    hostname: redis
    ports:
      - "6363:6379"
    networks:
      app_net:
        ipv4_address: 172.18.18.14
    volumes:
      - ./redis/data:/data

  memecached:
    image: 'memcached:latest'
    hostname: memecached
    ports:
      - "11218:11212"
    networks:
      app_net:
        ipv4_address: 172.18.18.15

  setup-rs:
    image: "setup-rs"
    build: ./setup
    depends_on:
      - "mongo-rs0-1"

networks:
  app_net:
    driver: bridge
    driver_opts:
      com.docker.network.enable_ipv6: "false"
    ipam:
      driver: default
      config:
      - subnet: 172.18.18.0/24

volumes:
  dbData:
