version: '3.4'

services:

  seq:
    image: datalust/seq:latest

  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: ${REGISTRY:-eshop}/identity.api:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Identity/Identity.API/Dockerfile    
    depends_on:
      - sql.data

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

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

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

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

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

  payment.api:
    image: ${REGISTRY:-eshop}/payment.api:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Payment/Payment.API/Dockerfile
    depends_on:
      - rabbitmq    

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

  webhooks.api:
    image: ${REGISTRY:-eshop}/webhooks.api:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: src/Services/Webhooks/Webhooks.API/Dockerfile
    depends_on:
      - sql.data    

  mobileshoppingapigw:
    image: ${REGISTRY:-eshop}/ocelotapigw:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/ocelotapigw:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/ocelotapigw:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/ocelotapigw:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/mobileshoppingagg:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/webshoppingagg:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/ordering.signalrhub:${PLATFORM:-linux}-${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: ${REGISTRY:-eshop}/webstatus:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: src/Web/WebStatus/Dockerfile

  webspa:
    image: ${REGISTRY:-eshop}/webspa:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: src/Web/WebSPA/Dockerfile    
      args:
        NODE_IMAGE: ${NODE_IMAGE:-node:8.11}
#    depends_on:
#      - webshoppingagg
#      - webshoppingapigw
#      - webmarketingapigw

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

  webhooks.client:
    image: ${REGISTRY:-eshop}/webhooks.client:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: src/Web/WebhookClient/Dockerfile
    depends_on:
      - webhooks.api    

  envoy:
    image: envoyproxy/envoy