

version: "3.9"
services:
  web:
    image: frontend
    build: ../frontend
    stdin_open: true # docker run -i
    tty: true        # docker run -t
    ports:
      - "3000:3000"
  db:
    image: postgres
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
      - POSTGRES_DB=db_pulseone
    ports:
      - "5432:5432"
  backend:
    image: backend
    volumes:
    - ./wait-for-it.sh:/usr/src/app/wait-for-it.sh
    - ./start-backend.sh:/usr/src/app/start-backend.sh
    build: ../backend
    environment:
     - DB_HOST=db
    ports:
     - "8080:8080"
    depends_on:
     - "db"

    command: ["bash", "./wait-for-it.sh", "db:5432", "--timeout=0", "--strict", "--", "bash", "./start-backend.sh"]

