From 50d063854b27b78390e67b85fce93547fabd1ddd Mon Sep 17 00:00:00 2001 From: tiero <3596602+tiero@users.noreply.github.com> Date: Wed, 8 May 2024 13:12:53 +0200 Subject: [PATCH] Mount bitcoin datadir and gh action to publish to ghcr.io --- .github/workflows/docker-publish.yml | 45 ++++++++++++++++++++++++++++ Dockerfile | 4 +-- README.md | 12 ++++++-- 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..301aa25 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,45 @@ +name: Docker + +on: + push: + # Publish `master` as Docker `latest` image. + branches: + - master + +env: + # TODO: Change variable to your image's name. + IMAGE_NAME: bitcoin-matt + +jobs: + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + runs-on: ubuntu-latest + if: github.event_name == 'push' + env: + DOCKER_CLI_EXPERIMENTAL: "enabled" + + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build image + run: >- + docker buildx build --push + --tag ghcr.io/vulpemventures/$IMAGE_NAME:latest + --platform linux/arm64,linux/amd64 . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d2e35e3..d53433c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,6 @@ COPY --from=builder /bitcoin/src/bitcoin-cli /usr/local/bin/ EXPOSE 18443 18444 -COPY bitcoin.conf /root/.bitcoin/bitcoin.conf +VOLUME /root/.bitcoin -CMD ["bitcoind", "-printtoconsole"] \ No newline at end of file +ENTRYPOINT ["bitcoind", "-printtoconsole"] \ No newline at end of file diff --git a/README.md b/README.md index 4930c56..9d29b73 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# README.md +# Bitcoin Core with opcodes for MATT + +This repository is a fork of [bitcoin-matt docker image](https://github.com/Merkleize/docker) that expect a volume to be mounted for the Bitcoin data directory, to being able to side load the `bitcoin.conf` at runtime instead of being shipped inside the container at buildtime. + ## Bitcoin + MATT Docker Container @@ -32,13 +35,16 @@ docker build -t bitcoin_matt . docker pull bigspider/bitcoin_matt ``` - ### Run the Docker Container +Before running the Docker container, ensure that you have a Bitcoin data directory on your host machine. This directory should contain your `bitcoin.conf` file and will be used to persist data across container restarts. + ```bash -docker run -d -p 18443:18443 bigspider/bitcoin_matt +docker run -d -p 18443:18443 -v /path/to/your/bitcoin/data:/root/.bitcoin bigspider/bitcoin_matt ``` +Replace `/path/to/your/bitcoin/data` with the actual path to your Bitcoin data directory on your host machine. This will mount the directory into the container at `/root/.bitcoin`. + Exposing port 18443 allows interacting with it using `bitcoin-cli -regtest` as normal, as long as a recent version of `bitcoin-cli` is in the path. Alternatively, once the container is running, one can access a terminal in it with: