version: '2.2'
services:
  adapter:
    build:
      context: .
      dockerfile: ./Dockerfile
      args:
        NPM_TOKEN: $NPM_TOKEN
    environment:
      LOGGING_LEVEL: debug
      SHOW_ERROR_STACK: 'true'
      RABBITMQ_URL: amqp://rabbitmq
      SERVICE_QUEUE_NAME: policy-service
      CMD_EXCHANGE_NAME: cmd-exchange
    depends_on:
      rabbitmq:
        condition: service_healthy
    command: npm run start:dev
    volumes:
      - './src:/app/src'
    ports:
      - '8080:8080'

  rabbitmq:
    image: rabbitmq:3.8-management-alpine
    healthcheck:
      test: ['CMD', 'rabbitmqctl', 'node_health_check']
      timeout: 5s
      retries: 5
    restart: on-failure
    ports:
      # The standard AMQP protocol port
      - '5672:5672'
      # HTTP management UI
      - '15672:15672'
