version: "3.5"

services:
  cassandra:
    image: cassandra:3.11
    networks:
      services-network:
        aliases:
          - cassandra

  mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - ./mysql-init:/docker-entrypoint-initdb.d
    networks:
      services-network:
        aliases:
          - mysql

  postgresql:
    image: postgres:9.6
    environment:
      POSTGRES_USER: temporal
      POSTGRES_PASSWORD: temporal
    volumes:
      - ./postgresql-init:/docker-entrypoint-initdb.d
    networks:
      services-network:
        aliases:
          - postgresql

  elasticsearch:
    image: elasticsearch:6.8.13
    networks:
      services-network:
        aliases:
          - elasticsearch
    environment:
      - discovery.type=single-node

  integration-test-cassandra:
    build:
      context: ../..
      dockerfile: ./develop/buildkite/Dockerfile
    environment:
      - "CASSANDRA_SEEDS=cassandra"
      - "ES_SEEDS=elasticsearch"
      - "ES_VERSION=v6"
      - "PERSISTENCE_TYPE=nosql"
      - "PERSISTENCE_DRIVER=cassandra"
      - "TEST_TAG=esintegration"
      - "TEMPORAL_VERSION_CHECK_DISABLED=1"
      - BUILDKITE_AGENT_ACCESS_TOKEN
      - BUILDKITE_JOB_ID
      - BUILDKITE_BUILD_ID
      - BUILDKITE_BUILD_NUMBER
    depends_on:
      - cassandra
      - elasticsearch
    volumes:
      - ../..:/temporal
      - /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
    networks:
      services-network:
        aliases:
          - integration-test

networks:
  services-network:
    name: services-network
    driver: bridge
