diff --git a/README.md b/README.md index 4f3f922..b8b472a 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,111 @@ -# docker-bitcoind +lncm/bitcoind +============= -![](https://img.shields.io/microbadger/image-size/lncm/bitcoind/0.17.1.svg?style=flat) ![](https://img.shields.io/docker/pulls/lncm/bitcoind.svg?style=flat) +![Build Status] +[![gh_last_release_svg]][gh_last_release_url] +[![Docker Image Size]][lnd-docker-hub] +[![Docker Pulls Count]][lnd-docker-hub] -This Dockerfile is based on the excellent work from [ruimarinho/docker-bitcoin-core](https://github.com/ruimarinho/docker-bitcoin-core/). +[Build Status]: https://github.com/lncm/docker-bitcoind/workflows/Build%20%26%20deploy%20on%20git%20tag%20push/badge.svg -The changes from upstream include: +[gh_last_release_svg]: https://img.shields.io/github/v/release/lncm/docker-bitcoind?sort=semver +[gh_last_release_url]: https://github.com/lncm/docker-bitcoind/releases/latest -* removal of everything except the very minimal `alpine` images for the latest `bitcoin` version -* separation of `berkeleydb` stage into a separate [image] -* removal of the entrypoint -* removal of an extra user -* overall simplifications and following defaults -* more… +[Docker Image Size]: https://img.shields.io/microbadger/image-size/lncm/bitcoind.svg +[Docker Pulls Count]: https://img.shields.io/docker/pulls/lncm/bitcoind.svg?style=flat +[lnd-docker-hub]: https://hub.docker.com/r/lncm/bitcoind + + +This repo builds [`bitcoind`] in an auditable way, and packages it into a minimal Docker containers provided for various CPU architectures. + +[`bitcoind`]: https://github.com/bitcoin/bitcoin + + +> The work here was initially based on [ruimarinho/docker-bitcoin-core](https://github.com/ruimarinho/docker-bitcoin-core/), but has significantly diverged since. + + +#### Details + +* **All [`git-tags`]** (and most commits) **are signed** by `D8CA1776EB9265491D07CE67F546ECBEA809CB18` +* **All [`git-tags`]** (and most commits) **are [`opentimestamps`]-ed** +* **All builds aim to be maximally auditable.** After `git tag push`, the entire process is automated, with each step printed, and the code aiming to be easy to follow +* All builds are based on [Alpine] +* Cross-compiled builds are done using our (also auditable) [`qemu`] +* To fit build and complete `make check` test suite, BerkeleyDB is build separately [here] +* Each build produces binaries for: `amd64`, `arm64v8`, and `arm32v7` +* All architectures are aggregated under an easy-to-use [Docker Manifest] +* All [`git-tags`] are [build automatically], and with an [auditable trace] +* Each successful build of a `git tag` pushes result Docker image to [Docker Hub] +* Each successful build of a `git tag` uploads result Go binaries to [Github Releases] +* Images pushed to Docker Hub are never deleted (even if `lnd` version gets overriden, previous one is preserved) +* All `final` images are based on Alpine for minimum base size +* All binaries are [`strip`ped] +* Each `git-tag` build is tagged with a unique tag number +* Each _minor_ version is stored in a separate directory (for the ease of backporting patches) + + +[`git-tags`]: https://github.com/lncm/docker-lnd/tags +[`opentimestamps`]: https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage +[Alpine]: https://github.com/lncm/docker-bitcoind/blob/6beae356ba16ee0297427c6401cd34f93044e256/0.19/Dockerfile#L11-L12 +[`qemu`]: https://github.com/meeDamian/simple-qemu +[here]: https://github.com/lncm/docker-berkeleydb +[Docker Manifest]: https://github.com/lncm/docker-bitcoind/blob/6beae356ba16ee0297427c6401cd34f93044e256/.github/workflows/on-tag.yml#L177-L193 +[build automatically]: https://github.com/lncm/docker-bitcoind/blob/6beae356ba16ee0297427c6401cd34f93044e256/.github/workflows/on-tag.yml +[auditable trace]: https://github.com/lncm/docker-bitcoind/runs/507498587?check_suite_focus=true +[Docker Hub]: https://github.com/lncm/docker-bitcoind/blob/6beae356ba16ee0297427c6401cd34f93044e256/.github/workflows/on-tag.yml#L167-L193 +[Github Releases]: https://github.com/lncm/docker-bitcoind/blob/6beae356ba16ee0297427c6401cd34f93044e256/.github/workflows/on-tag.yml#L196-L203 +[`strip`ped]: https://github.com/lncm/docker-bitcoind/blob/6beae356ba16ee0297427c6401cd34f93044e256/0.19/Dockerfile#L176 -[image]: https://hub.docker.com/r/lncm/berkeleydb > **NOTE:** ZMQ `block` and `tx` ports are set to `28332` and `28333` respectively. ## Tags -* `latest`, `0.17`, `0.17.1` - currently _latest_ version of Bitcoin Core for both `arm` and `amd64` -* `0.17.1-linux-arm` - Bitcoin Core version 0.17.1 for `arm` architecture (built manually on an RBP) -* `0.17.1-linux-amd64` - Bitcoin Core version 0.17.1 for `amd64` architecture (built via CI) +> **NOTE:** For an always up-to-date list see: https://hub.docker.com/r/lncm/bitcoind/tags + +* `v0.19.1` +* `v0.19.0.1` +* `v0.19.0` +* `v0.18.1` +* `v0.17.2` +* `v0.16.3` +* `v0.15.2` ## Usage - ### Pull First pull the image from [Docker Hub]: ```bash -docker pull lncm/bitcoind:0.17.1 +docker pull lncm/bitcoind:v0.19.1 ``` > **NOTE:** Running above will automatically choose native architecture of your CPU. [Docker Hub]: https://hub.docker.com/r/lncm/bitcoind +Or, to pull a specific CPU architecture: + +```bash +docker pull lncm/bitcoind:v0.19.1-arm64v8 +``` #### Start -Then to start bitcoind, execute: +Then to start bitcoind, run: ```bash -docker run -it --rm \ - -v ~/.bitcoin:/root/.bitcoin \ +docker run -it --rm --detach \ + -v ~/.bitcoin:/data/.bitcoin \ -p 8332:8332 \ -p 8333:8333 \ -p 28332:28332 \ -p 28333:28333 \ --name bitcoind \ - --detach \ - lncm/bitcoind:0.17.1 + lncm/bitcoind:v0.19.1 ``` That will run bitcoind such that: @@ -65,6 +116,7 @@ That will run bitcoind such that: * port `28332` will be reachable for ZMQ **block** notifications, * port `28333` will be reachable for ZMQ **transaction** notifications, * created container will get named `bitcoind`, +* within the container, `bitcoind` binary is run as unprivileged user `bitcoind` (`UID=1000`), * that command will run the container in the background and print the ID of the container being run. @@ -77,7 +129,7 @@ docker exec -it bitcoind BINARY COMMAND ``` Where: -* `BINARY` is either `bitcoind` or `bitcoin-cli`, and +* `BINARY` is either `bitcoind`, `bitcoin-cli`, `bitcoin-tx`, (or `bitcoin-wallet` on `v0.18+`) and * `COMMAND` is something you'd normally pass to the binary Examples: diff --git a/scripts/list-tags.sh b/scripts/list-tags.sh new file mode 100755 index 0000000..f0df6c3 --- /dev/null +++ b/scripts/list-tags.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -eo pipefail + +# +## This script returns all lnd tags sorted newest to oldest, with all variants of the same version on the same line +# + +main() { + declare repo="$1" + + curl -s "https://registry.hub.docker.com/v1/repositories/$repo/tags" \ + | jq -r '.[].name' \ + | grep '^v.*' \ + | grep -v '\-build' \ + | tr -s '-' '~' \ + | sort -Vr | uniq \ + | tr -s '~' '-' \ + | grep -v '\-\(arm32\|arm64\|amd64\|linux-arm\)' \ + | awk -F- 'NR==1 {printf "* "}; $1!=a && NR>1 {print "\n* "}; {ORS=""; printf "`%s` ", $0}; {a=$1}' + + echo +} + +main "lncm/bitcoind"