version: "3.4"

# Start the ledgers first
# ./etc/cactus should already exist and contain cactus node configs

services:
  cmd-socketio-base-image:
    # Build base image and immediately exit
    container_name: cmd-socketio-base-dummy
    image: cactus-cmd-socketio-server
    build:
      context: ../../packages/cactus-cmd-socketio-server/
    command: ["echo", "OK - Exit"]

  ethereum-validator:
    container_name: cactus-example-electricity-trade-ethereum-validator
    image: cactus-plugin-ledger-connector-go-ethereum-socketio
    build:
      context: ../../packages/cactus-plugin-ledger-connector-go-ethereum-socketio/
    ports:
      - "5050:5050"
    networks:
     - geth1net
     - cactus-example-electricity-trade-net
    depends_on:
      - cmd-socketio-base-image
    volumes:
        - type: bind
          source: ./etc/cactus
          target: /etc/cactus

  sawtooth-validator:
    container_name: cactus-example-electricity-trade-sawtooth-validator
    image: cactus-plugin-ledger-connector-sawtooth-socketio
    build:
      context: ../../packages/cactus-plugin-ledger-connector-sawtooth-socketio/
    ports:
      - "5140:5140"
    networks:
      - sawtooth_aio_testnet_1x
      - cactus-example-electricity-trade-net
    depends_on:
      - cmd-socketio-base-image
    volumes:
        - type: bind
          source: ./etc/cactus
          target: /etc/cactus

  cactus-example-electricity-trade-blp:
    container_name: cactus-example-electricity-trade-blp
    image: cactus-example-electricity-trade-blp
    build:
      context: .
    ports:
      - "5034:5034"
    networks:
     - cactus-example-electricity-trade-net
    depends_on:
      - ethereum-validator
      - sawtooth-validator
      - cmd-socketio-base-image
    volumes:
        - type: bind
          source: ./etc/cactus
          target: /etc/cactus

networks:
  sawtooth_aio_testnet_1x:
    external: true
  geth1net:
    external: true
  cactus-example-electricity-trade-net:
    driver: bridge
