#
# This file is used for development. It it not intended for production!
# See https://libretime.org/docs/developer-manual/development/environment/#docker-compose
#
services:
  postgres:
    ports:
      - 5432:5432

  rabbitmq:
    image: rabbitmq:management-alpine
    ports:
      - 5672:5672
      - 15672:15672

  playout:
    build:
      context: .
      target: libretime-playout
    volumes:
      - ./playout:/src
      - ./dev/playout:/app

  liquidsoap:
    build:
      context: .
      target: libretime-playout
    ports:
      - 1234:1234
    volumes:
      - ./playout:/src
      - ./dev/playout:/app
      - ./dev/certs:/certs
      ## See https://libretime.org/docs/admin-manual/tutorials/setup-a-pulseaudio-output-inside-containers/
      # - ./dev/pulse.socket:/tmp/pulse.socket
      # - ./docker/pulse.client.conf:/etc/pulse/client.conf

  analyzer:
    build:
      context: .
      target: libretime-analyzer
    volumes:
      - ./analyzer:/src

  worker:
    build:
      context: .
      target: libretime-worker
    volumes:
      - ./worker:/src

  api:
    build:
      context: .
      target: libretime-api
    volumes:
      - ./api:/src
    command: /usr/local/bin/libretime-api runserver 0.0.0.0:9001
    environment:
      LIBRETIME_DEBUG: "true"

  legacy:
    build:
      context: .
      target: libretime-legacy
    volumes:
      - ./legacy:/var/www/html

  sintonia-webapp:
    build:
      context: .
      target: sintonia-webapp-dev
      args:
        - sintonia_laravel_port=${SINTONIA_LARAVEL_PORT}
        - sintonia_vite_port=${SINTONIA_VITE_PORT}
    image: sintonia-webapp-dev
    container_name: sintonia-webapp-dev
    working_dir: /var/www/sintonia_webapp
    volumes:
      - ./sintonia_webapp:/var/www/sintonia_webapp
      - libretime_storage:/srv/libretime
    ports:
      - 9000:9000
#      - ${SINTONIA_LARAVEL_PORT}:${SINTONIA_LARAVEL_PORT}
      - ${SINTONIA_VITE_PORT}:${SINTONIA_VITE_PORT}
    environment:
      - sintonia_laravel_port=${SINTONIA_LARAVEL_PORT}
      - sintonia_vite_port=${SINTONIA_VITE_PORT}
      - PHP_IDE_CONFIG=serverName=sintonia

  nginx:
    volumes:
      - ./legacy:/var/www/html
      - ./sintonia_webapp:/var/www/sintonia_webapp

  icecast:
    ports:
      - 8000:8000
      - 8443:8443
    environment:
      ICECAST_MAX_SOURCES: 10
    volumes:
      - ./dev/certs:/certs
      - ./dev/icecast.xml:/etc/icecast.xml

  mailpit:
    image: axllent/mailpit
    ports:
      - 8025:8025
      - 1025:1025