Docker - nodejsapp_docker-compose.yml

version: "2"
services:
  app-prod:
    container_name: app-prod
    image: node:10.10
    restart: always
    working_dir: /usr/src/app
    command: sh -c 'npm install >> /var/log/console.log 2>&1; npm start >> /var/log/console.log 2>&1'
    volumes:
      - ../../:/usr/src/app
      - ./log:/var/log/
    ports:
      - "3000:3000"
    links:
      - mongo-prod
    network_mode: bridge
  mongo-prod:
    container_name: mongo-prod
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: 'x'
    image: mongo:4.0.1
    restart: always
    volumes:
      - mongodata-prod:/data/db
    network_mode: bridge
    command: mongod --port 27017 --bind_ip_all
volumes:
  mongodata-prod: