version: '3'
services:
  bpanel:
    ## Build to use local Dockerfile
    # build: .
    ## Build from image from docker hub
    image: bpanel/bpanel
    restart: unless-stopped
    environment:
      # Need this to tell the bpanel client
      # how to communicate with the bcoin node
      # in docker
      _DOCKER_NODE_HOST: bcoin
    ports:
      - "5000:5000"
      - "8000:8000"
    volumes:
      ## Mapping to local files- Handy for dev
      - ./webapp:/usr/src/app/webapp
      - ./server:/usr/src/app/server
      - ./package.json:/usr/src/app/package.json
      - ./package-lock.json:/usr/src/app/package-lock.json
      # - ./scripts:/usr/src/app/scripts
      # Use below to get configs written by bcoin service
      - configs:/root/.bpanel
      # Use below to copy local bpanel config files
      # - ~/.bpanel:/root/.bpanel
    ## Only MacOSX users need --watch-poll
    ## the client-id says to use the config created by the
    ## bcoin docker services
    command: server --dev --watch-poll --client-id=_docker

  securityc:
    image: bpanel/securityc
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    env_file:
      - ./securityc.env
    volumes:
      # mount local cert directory into container
      - certs:/etc/ssl/nginx

  bcoin:
    ## Use image to to pull from docker hub
    image: bpanel/bcoin
    ## Build to use local Dockerfile-bcoin
    # build:
    #   context: .
    #   dockerfile: Dockerfile-bcoin
      # args:
      #   repo: https://github.com/bcoin-org/bcoin.git
      #   branch: master
      #   rebuild: 0
    restart: unless-stopped
    env_file:
      # Set arguments to use in bcoin-init.js
      - ./etc/regtest.bcoin.env
    ports:
      ## Comment these if they conflict with something else you're running.
      #-- Mainnet
      - "8333:8333"
      - "8332:8332" # RPC
      - "8334:8334" # Wallet
      #-- Testnet
      - "18333:18333"
      - "18332:18332" # RPC
      - "18334:18334" # Wallet
      #-- Regtest
      - "48444:48444"
      - "48332:48332" # RPC
      - "48334:48334" # Wallet
      #-- Simnet
      - "18555:18555"
      - "18556:18556" # RPC
      - "18558:18558" # Wallet
    volumes:
      - ./scripts:/code/scripts
      # # Use below config to persist bcoin data in docker volume
      - bcoin:/data
      # # Use below config to write bcoin configs to a bpanel client
      - configs:/data/.bpanel
      # # Use below config instead to use bcoin data from local home dir
      # - ~/.bcoin:/data/.bcoin

volumes:
  certs:
  bcoin:
  configs:
    driver_opts:
      type: none
      device: $HOME/.bpanel
      o: bind
