version: "3.4"
services:
  mongodb:
    image: mongo
    restart: always
    ports:
      - "127.0.0.1:${MONGODB_PORT}:${MONGODB_PORT}"
    environment:
      MONGO_INITDB_ROOT_USERNAME: "${MONGODB_USER}"
      MONGO_INITDB_ROOT_PASSWORD: "${MONGODB_PASS}"
      MONGO_INITDB_DATABASE: "${DB_NAME}"
    volumes:
      - mongodata:/data/db
    networks:
      - mongonet
networks:
  mongonet:
    driver: bridge

volumes:
  mongodata: