version: "3.8"
services:

  # base images
  flask_service:
    build:
      context: ../shared/flask
    image: flask_service:python-3.10-slim-bullseye
    restart: "no"
    deploy:
      replicas: 0

  tracing:
    build:
      context: ../shared/tracing
    image: envoyproxy:tracing
    restart: "no"
    deploy:
      replicas: 0

  # jaeger
  front-envoy:
    build:
      context: .
      dockerfile: Dockerfile-frontenvoy
    ports:
    - "${PORT_PROXY:-10000}:8000"
    dns:
    - 8.8.8.8
    - 8.8.4.4

  service1:
    build:
      context: .
      dockerfile: Dockerfile-jaeger-service
    volumes:
    - ./service1-envoy-jaeger.yaml:/etc/service-envoy.yaml
    environment:
    - SERVICE_NAME=1
    dns:
    - 8.8.8.8
    - 8.8.4.4

  service2:
    build:
      context: .
      dockerfile: Dockerfile-jaeger-service
    volumes:
    - ./service2-envoy-jaeger.yaml:/etc/service-envoy.yaml
    environment:
    - SERVICE_NAME=2
    dns:
    - 8.8.8.8
    - 8.8.4.4

  jaeger:
    build:
      context: .
      dockerfile: Dockerfile-jaeger
    environment:
    - COLLECTOR_ZIPKIN_HOST_PORT=9411
    ports:
    - "${PORT_UI:-10000}:16686"
