version: '2.4'
services:
  postgres:
    image: ${CI_REGISTRY}/mattermost/ci/images/postgres:10-1
    restart: always
    environment:
      POSTGRES_USER: mmuser
      POSTGRES_PASSWORD: mostest
      POSTGRES_DB: mattermost_test
    command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
    volumes:
     - "./docker/postgres.conf:/etc/postgresql/postgresql.conf"
    healthcheck:
      test: [ "CMD", "pg_isready", "-h", "localhost" ]
      interval: 5s
      timeout: 10s
      retries: 3
    networks:
      default:
        aliases:
          - postgres

  start_dependencies:
    image: ${CI_REGISTRY}/mattermost/ci/images/mattermost-wait-for-dep:latest-1
    depends_on:
      - postgres
    command: postgres:5432
    networks:
      default:

networks:
  default:
    external:
      name: ${COMPOSE_PROJECT_NAME}
