version: '3.4'

services:

  seq:
    image: datalust/seq:latest

  sqldata:
    image: mcr.microsoft.com/mssql/server:2017-latest 

  nosqldata:
    image: mongo

  basketdata:
    image: redis:alpine

  rabbitmq:
    image: rabbitmq:3-management-alpine

  identity-api:
    image: ${REGISTRY:-eshop}/identity.api:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: Services/Identity/Identity.API/Dockerfile
    depends_on:
      - sqldata

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

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

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

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

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

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

  mobileshoppingapigw:
    image: envoyproxy/envoy:v1.11.1

  mobileshoppingagg:
    image: ${REGISTRY:-eshop}/mobileshoppingagg:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile
    depends_on:
      - nosqldata
      - sqldata
      - identity-api
      - rabbitmq
      - ordering-api
      - catalog-api
      - basket-api

  webshoppingagg:
    image: ${REGISTRY:-eshop}/webshoppingagg:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile
    depends_on:
      - nosqldata
      - sqldata
      - identity-api
      - rabbitmq
      - ordering-api
      - catalog-api
      - basket-api

  ordering-signalrhub:
    image: ${REGISTRY:-eshop}/ordering.signalrhub:${PLATFORM:-linux}-${TAG:-latest}
    build:
      context: .
      dockerfile: Services/Ordering/Ordering.SignalrHub/Dockerfile
    depends_on:
      - nosqldata
      - sqldata
      - identity-api
      - rabbitmq
      - ordering-api
      - catalog-api
      - basket-api

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

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

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

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

  webshoppingapigw:
    image: envoyproxy/envoy:v1.11.1
