services:

  app:
    build: .
    depends_on:
      - postgres
    image: PROJECT_NAME
    links:
      - postgres
    ports:
      - "4000:4000"
    volumes:
      - app_build:/build
      - app_deps:/deps
      - .:/app

  postgres:
    environment:
      POSTGRES_PASSWORD: postgres
    image: "postgres:16.3-alpine"
    volumes:
      - db:/var/lib/postgresql/data
      - ~/.psqlrc:/root/.psqlrc:ro

  test:
    command: ["/docker/run_tests.sh"]
    depends_on:
      - postgres
    image: PROJECT_NAME
    links:
      - postgres
    volumes:
      - test_build:/build
      - test_deps:/deps
      - .:/app

volumes:
  app_build:
  app_deps:
  db:
  test_build:
  test_deps:
