# This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from
# https://github.com/overleaf/internal/

version: "2.3"

services:
  test_unit:
    image: node:20.18.2
    volumes:
      - .:/overleaf/services/contacts
      - ../../node_modules:/overleaf/node_modules
      - ../../libraries:/overleaf/libraries
    working_dir: /overleaf/services/contacts
    environment:
      MOCHA_GREP: ${MOCHA_GREP}
      LOG_LEVEL: ${LOG_LEVEL:-}
      NODE_ENV: test
      NODE_OPTIONS: "--unhandled-rejections=strict"
    command: npm run --silent test:unit
    user: node

  test_acceptance:
    image: node:20.18.2
    volumes:
      - .:/overleaf/services/contacts
      - ../../node_modules:/overleaf/node_modules
      - ../../libraries:/overleaf/libraries
    working_dir: /overleaf/services/contacts
    environment:
      ELASTIC_SEARCH_DSN: es:9200
      MONGO_HOST: mongo
      POSTGRES_HOST: postgres
      MOCHA_GREP: ${MOCHA_GREP}
      LOG_LEVEL: ${LOG_LEVEL:-}
      NODE_ENV: test
      NODE_OPTIONS: "--unhandled-rejections=strict"
    user: node
    depends_on:
      mongo:
        condition: service_started
    command: npm run --silent test:acceptance

  mongo:
    image: mongo:6.0.13
    command: --replSet overleaf
    volumes:
      - ../../bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js
    environment:
      MONGO_INITDB_DATABASE: sharelatex
    extra_hosts:
      # Required when using the automatic database setup for initializing the
      # replica set. This override is not needed when running the setup after
      # starting up mongo.
      - mongo:127.0.0.1

