#!/bin/sh

if [ -z "$BT_APP" ]; then
    echo The enironment variable BT_APP must be set to the name of the crate to build.
    exit 1
fi

mkdir -p ~/.config/blocktree/$BT_APP
sudo docker run --rm --name $BT_APP\
    -v ~/.config/blocktree:/app/state\
    --env RUST_LOG=warn\
    $BT_APP:latest "$@"