services:
    postgres:
        image: postgres
        ports:
            - 5432:5432
        environment:
            POSTGRES_PASSWORD: "password"

    nginx:
        image: nginx
        depends_on:
            - second
            - first
        volumes:
            - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
        ports:
            - 80:80
    
    first:
        build: .\DSaC
        depends_on:
            - postgres
        environment:
            DATABASE_CONNECTION_STRING: "Host=postgres;Database=dsac_maxim_1;Username=postgres;Password=password"
            GATEWAY_SETTINGS_APP_PREFIX: "first" # Нужно, чтобы запросы из Swagger работали нормально 

    second:
        build: .\DSaC_second
        depends_on:
            - first
        environment:
            DATABASE_CONNECTION_STRING: "Host=postgres;Database=dsac_maxim_2;Username=postgres;Password=password"
            FIRST_SERVICE_BASE_URL: "http://nginx/first/api"
            FIRST_SERVICE_GET_COUNTERPARTY_POSTFIX: "/Counterparties"
            GATEWAY_SETTINGS_APP_PREFIX: "second"

    