version: '3'

services:
  sut:
    build: .
    ports:
      - 8080
    depends_on:
      - db
    environment:
      - DEBUG=1  # remove this line to turn DEBUG off
      - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
      - AUTH_REQUIRED=False
      - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
      - PLUGINS=reject,blackout,normalise,enhance

  tester:
    image: tutum/curl:latest
    volumes:
      - ./wait-for-it.sh:/usr/local/bin/wait-for-it.sh
      - ./tests.sh:/tests.sh
    depends_on:
      - sut
    command: ["wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "/tests.sh"]

  db:
    image: postgres
    volumes:
      - ./pg-data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: monitoring
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres


version: '3'

services:
  sut:
    build: .
    image: alerta/alerta-web
    ports:
      - 8080
    depends_on:
      - db
    environment:
      - DEBUG=1  # remove this line to turn DEBUG off
      - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
      - AUTH_REQUIRED=False
      - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
      - PLUGINS=reject,blackout,normalise,enhance

  tester:
    image: tutum/curl:latest
    volumes:
      - ./wait-for-it.sh:/usr/local/bin/wait-for-it.sh
      - ./tests.sh:/tests.sh
    depends_on:
      - sut
    command: ["wait-for-it.sh", "sut:8080", "-t", "240", "--", "sh", "/tests.sh"]

  db:
    image: postgres
    volumes:
      - ./pg-data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: monitoring
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres


Test image if already built
Test image if already built
