services:
  back:
    build:
      context: ./back
      dockerfile: Dockerfile.dev
    privileged: true
    ports:
      - "3000:3000"
    volumes:
      - ./back:/app
      - ./musics:/musics
    depends_on:
      db:
        condition: service_healthy
    env_file:
      - .env

  scorometer:
    build: 
      context: ./scorometer
      dockerfile: Dockerfile.dev
    ports:
      - "6543:6543"
    volumes:
      - ./scorometer:/app
      - ./musics:/musics
    
  db:
    container_name: db
    image: postgres:alpine3.14
    environment:
    - POSTGRES_USER=${POSTGRES_USER}
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=${POSTGRES_DB}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5
    ports:
      - "5432:5432"
  front:
    build: 
      context: ./front
      dockerfile: Dockerfile.dev
    environment:
      - SCOROMETER_URL=http://scorometer:6543/
      - NGINX_PORT=80
    ports:
      - "19006:19006"
    volumes:
      - ./front:/app
    depends_on:
      - "back"
    env_file:
      - .env