version: '3'
services:
  psql:
    image: postgres:9.6.2-alpine
  test:
    image: node:12-alpine
    working_dir: /usr/app/
    volumes:
      - .:/usr/app/
    depends_on:
      - psql
    environment:
      - DATABASE_URL=postgres://postgres@psql:5432/postgres
    command: /bin/sh -c "yarn && sleep 10 && yarn migrate && ./node_modules/jest-cli/bin/jest.js --forceExit"
