version: '3.4'

services:
  sql.data:
    image: microsoft/mssql-server-linux:2017-latest

  nosql.data:
    image: mongo

  basket.data:
    image: redis:alpine
      
  rabbitmq:
    image: rabbitmq:3-management-alpine

  identity.api:
    image: eshop/identity.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Identity/Identity.API/Dockerfile    
    depends_on:
      - sql.data

  basket.api:
    image: eshop/basket.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Basket/Basket.API/Dockerfile    
    depends_on:
      - basket.data
      - identity.api
      - rabbitmq

  catalog.api:
    image: eshop/catalog.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Catalog/Catalog.API/Dockerfile
    depends_on:
      - sql.data
      - rabbitmq

  ordering.api:
    image: eshop/ordering.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Ordering/Ordering.API/Dockerfile    
    depends_on:
      - sql.data
      - rabbitmq

  ordering.backgroundtasks:
    image: eshop/ordering.backgroundtasks:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Ordering/Ordering.BackgroundTasks/Dockerfile    
    depends_on:
      - sql.data
      - rabbitmq

  marketing.api:
    image: eshop/marketing.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Marketing/Marketing.API/Dockerfile    
    depends_on:
      - sql.data
      - nosql.data
      - identity.api
      - rabbitmq

  payment.api:
    image: eshop/payment.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Payment/Payment.API/Dockerfile
    depends_on:
      - rabbitmq    
    
  locations.api:
    image: eshop/locations.api:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Location/Locations.API/Dockerfile
    depends_on:
      - nosql.data
      - rabbitmq

  mobileshoppingapigw:
    image: eshop/ocelotapigw:${TAG:-latest}
    build:
      context: .
      dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api
 
  mobilemarketingapigw:
    image: eshop/ocelotapigw:${TAG:-latest}
    build:
      context: .
      dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api
 
  webshoppingapigw:
    image: eshop/ocelotapigw:${TAG:-latest}
    build:
      context: .
      dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api

  webmarketingapigw:
    image: eshop/ocelotapigw:${TAG:-latest}
    build:
      context: .
      dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api

  mobileshoppingagg:
    image: eshop/mobileshoppingagg:${TAG:-latest}
    build:
      context: .
      dockerfile: src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api

  webshoppingagg:
    image: eshop/webshoppingagg:${TAG:-latest}
    build:
      context: .
      dockerfile: src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api

  ordering.signalrhub:
    image: eshop/ordering.signalrhub:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Ordering/Ordering.SignalrHub/Dockerfile
    depends_on:
      - nosql.data
      - sql.data
      - identity.api
      - rabbitmq
      - ordering.api
      - marketing.api
      - catalog.api
      - basket.api

  webstatus:
    image: eshop/webstatus:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Web/WebStatus/Dockerfile

  webspa:
    image: eshop/webspa:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Web/WebSPA/Dockerfile    
#    depends_on:
#      - webshoppingagg
#      - webshoppingapigw
#      - webmarketingapigw


  webmvc:
    image: eshop/webmvc:${TAG:-latest}
    build:
      context: .
      dockerfile: src/Web/WebMVC/Dockerfile    
    depends_on:
      - webshoppingagg
      - webshoppingapigw
      - webmarketingapigw