version: "3.7"

services:
  bitcoind:
    image: lncm/bitcoind:v22.0@sha256:37a1adb29b3abc9f972f0d981f45e41e5fca2e22816a023faa9fdc0084aa4507
    volumes:
      - ${PWD}/bitcoin:/data/.bitcoin
    restart: on-failure
    stop_grace_period: 15m30s
    ports:
      - "18443:18443"
      # - "8333:8333" # "$BITCOIN_P2P_PORT:$BITCOIN_P2P_PORT"
  server:
    build: .
    depends_on: [bitcoind]
    command: ["npm", "start"]
    restart: on-failure
    ports:
      - "3005:3005"
    environment:
      PORT: "3005"
      BITCOIN_HOST: "bitcoind"
      RPC_PORT: $BITCOIN_RPC_PORT
      RPC_USER: $BITCOIN_RPC_USER
      RPC_PASSWORD: $BITCOIN_RPC_PASS
      BITCOIN_RPC_HIDDEN_SERVICE: "/var/lib/tor/bitcoin-rpc/hostname"
      BITCOIN_P2P_HIDDEN_SERVICE: "/var/lib/tor/bitcoin-p2p/hostname"

networks:
  default:
    name: umbrel_main_network
    ipam:
      driver: default
      config:
        - subnet: "$NETWORK_IP/24"
