version: '2'

services:

  cli:
    container_name: cli
    image: hyperledger/fabric-peer
    tty: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_PEER_ADDRESSAUTODETECT=true
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_LOGGING_LEVEL=DEBUG
      - CORE_NEXT=true
      - CORE_PEER_ID=cli
      - CORE_PEER_ENDORSER_ENABLED=true
        # - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050
      - CORE_PEER_ADDRESS=peer0:7051
      - CORE_PEER_LOCALMSPID=Org0MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/signcerts/peer0Signer.pem
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/keystore/peer0Signer.pem
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem
      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig

    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; '
    #command: /bin/bash
    extra_hosts:
      - "orderer0:10.16.80.209"
      - "peer0:10.16.80.210"
      - "peer1:10.16.80.211"
      - "peer2:10.16.80.212"
      - "peer3:10.16.80.213"
    volumes:
      - /var/run/:/host/var/run/
      - ./examples/:/opt/gopath/src/github.com/hyperledger/fabric/examples/
      #- ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
      - ./crypto:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    #depends_on:
      #- orderer0
      #- peer0
      #- peer1
      #- peer2
      #- peer3
