services:
  postgresdb:
    image: postgres:latest
    container_name: postgres_container
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123
      POSTGRES_DB: administrator
      PGDATA: /var/lib/postgresql/data/pgdata
    ports:
      - "5430:5432"  # Проброс порта для PostgreSQL
    volumes:
      - ./database.sql:/docker-entrypoint-initdb.d/database.sql  # Инициализация базы данных
    restart: always
    networks:
      - desision-making-system-network

  administrator-service:
    container_name: administrator-service
    depends_on:
      - postgresdb  # Заивисмость от запуска Posgresql
    build:
      context: ./Administrator
      dockerfile: ./Administrator/Dockerfile
    environment:
      ASPNETCORE_ENVIRONMENT: "Development"  # Настраиваем среду разработки
      ASPNETCORE_URLS: "http://+:8080"
    ports:
      - "32773:8080"  # Проброс порта 8080
    networks:
      - desision-making-system-network

  buyer-service:
    container_name: buyer-service
    depends_on:
      - postgresdb  # Заивисмость от запуска Posgresql
    build:
      context: ./Buyer
      dockerfile: ./Buyer/Dockerfile
    environment:
      ASPNETCORE_ENVIRONMENT: "Development"  # Настраиваем среду разработки
      ASPNETCORE_URLS: "http://+:8080"
    ports:
      - "32774:8080"  # Проброс порта
    networks:
      - desision-making-system-network

networks:
  desision-making-system-network:
    driver: bridge