version: "3"
services:
  
  ### START: MONGO ALREADY RUNNING SO COMMENT OUT ###
  mongo:
    container_name: mongo
    image: mongo
    environment:
      - MONGO_INITDB_ROOT_USERNAME=superuser
      - MONGO_INITDB_ROOT_PASSWORD=XDAorbit2
      - MONGO_INITDB_DATABASE=admin
    # volumes:
    #   - ./data:/data/db
    volumes:
      - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
    command: [--auth, --quiet]
    ports:
      - "27017:27017"
  ### END: MONGO ALREADY RUNNING SO COMMENT OUT ### 


  # mongoClientTemp:
  #   image: mongo:latest
  #   container_name: mongoClientTemp
  #   links:
  #     - mongo:mongo
  #   command: mongo --host mongo --eval  "db.getSiblingDB('productkey').createUser({user:'superuser', pwd:'XDAorbit2', roles:[{role:'readWrite',db:'productkey'}]});"
  #   depends_on:
  #     - mongo

  app:
    container_name: app
    restart: always
    build: .
    # build:
    #   context: .
    #   dockerfile: Dockerfile
    ports:
      - "3000:3000"
    links:
      - mongo
    entrypoint: /bin/sh -c
    env_file:
      - .env
    command: ["npm start"]
    # depends_on:
    #   - mongoClientTemp