diff --git a/build/docker/bin/Dockerfile b/build/docker/bin/Dockerfile index b92044c0..042acd28 100644 --- a/build/docker/bin/Dockerfile +++ b/build/docker/bin/Dockerfile @@ -59,3 +59,5 @@ ADD Makefile /build/Makefile VOLUME /out WORKDIR /build + +CMD ["sh", "-c", "while true; do sleep 1000; done"] diff --git a/workshop/blockbook_build_and_run.sh b/workshop/blockbook_build_and_run.sh index 50dddff1..55e0594d 100755 --- a/workshop/blockbook_build_and_run.sh +++ b/workshop/blockbook_build_and_run.sh @@ -14,5 +14,5 @@ go build echo "Generating bitcoin regtest config..." ./contrib/scripts/build-blockchaincfg.sh bitcoin_regtest -echo "Running blockbook..." +echo "Running blockbook, visit http://localhost:9130/ in the browser..." ./blockbook -sync -blockchaincfg=build/blockchaincfg.json -internal=:9030 -public=:9130 -logtostderr -enablesubnewtx diff --git a/workshop/docker_run.md b/workshop/docker_run.md new file mode 100644 index 00000000..74957cdf --- /dev/null +++ b/workshop/docker_run.md @@ -0,0 +1,40 @@ +```sh +# Build the building image +make .bin-image + +# Run the image with mounted code volume and network connections +docker run -v ".:/src" -v "./build:/out" --network=host blockbook-build + +# Look at running containers +docker ps + +# Get the container ID for the blockbook-build container +CONTAINER_ID=$(docker ps -q --filter ancestor=blockbook-build) + +# Get a shell in the container +docker exec -it $CONTAINER_ID /bin/bash + +# Full copyable command +docker exec -it $(docker ps -q --filter ancestor=blockbook-build) /bin/bash + +--- + +# INSIDE THE CONTAINER + +# Go to the source code directory +cd /src +# Build the main binary +go build +# Regenerate config +./contrib/scripts/build-blockchaincfg.sh bitcoin_regtest +# Run the app ... logs should be visible in the terminal +./blockbook -sync -blockchaincfg=build/blockchaincfg.json -internal=:9030 -public=:9130 -logtostderr -enablesubnewtx +# Visit http://localhost:9130/ in the browser + +# LOOP: Now you can modify the code locally and always rebuild and run the app in the container + +--- + +# Stop the container +docker stop $CONTAINER_ID +```