version: "3.4"

services:
  redis:
    image: redis:alpine

  pgdb:
    image: postgres:11.7
    environment:
      POSTGRES_PASSWORD: bad_db_passwd
      POSTGRES_USER: core_notifications
      POSTGRES_DB: core_notifications
    command: [ "postgres", "-c", "log_statement=all", "-c", "fsync=off", "-c", "full_page_writes=off" ]

  pg_m:
    build:
      context: .
      dockerfile: ./migrations/Dockerfile
    env_file:
      - .env.sample
    command: [ "--", "--verify" ]
    depends_on:
      - pgdb

  app:
    build:
      context: .
      target: test
    env_file:
      - .env.sample
    volumes:
      - '.:/core-notifications'
    depends_on:
      - redis
      - pgdb
      - pg_m
