Skip to content

Commit 1cb3688

Browse files
committed
split signet miner from node image
1 parent bc9b275 commit 1cb3688

7 files changed

Lines changed: 98 additions & 14 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
RUNNER: ${{ matrix.runner }}
3333
VERSION: ${{ matrix.knots.version }}
3434
steps:
35-
- uses: actions/checkout@v5
35+
- uses: actions/checkout@v6
3636
- uses: docker/setup-buildx-action@v3
3737
- uses: docker/login-action@v3
3838
with:
@@ -97,3 +97,23 @@ jobs:
9797
package-type: container
9898
delete-only-untagged-versions: true
9999
min-versions-to-keep: 0
100+
101+
miner:
102+
name: Build signet miner image from latest Knots version
103+
runs-on: ubuntu-latest
104+
needs:
105+
- merge
106+
steps:
107+
- uses: actions/checkout@v6
108+
- uses: docker/setup-qemu-action@v3
109+
- uses: docker/setup-buildx-action@v3
110+
- uses: docker/login-action@v3
111+
with:
112+
username: 1maa
113+
password: ${{ secrets.DOCKER_HUB_PASS }}
114+
- uses: docker/bake-action@v6
115+
with:
116+
provenance: false
117+
push: true
118+
sbom: false
119+
targets: miner

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ services:
2828
2929
## Available Versions
3030
31+
* `1maa/bitcoin:latest`
32+
* `1maa/bitcoin:signet-miner`
3133
* `1maa/bitcoin:v29.2.knots20251110`
3234
* `1maa/bitcoin:v29.2.knots20251010`
3335
* `1maa/bitcoin:v29.1.knots20250903`
@@ -45,6 +47,6 @@ For a step-by-step guide to do a deterministic build of Bitcoin Knots and attest
4547

4648
## Signet Miner
4749

48-
This image includes the sources of the CPU signet miner from `contrib/signet`.
50+
The image variant `1maa/bitcoin:signet-miner` contains the `contrib/signet` CPU miner for signet networks.
4951

50-
For an example on how to use this image in signet mining mode refer to the `miner` service in the compose.yml file of the [signet-playground](https://github.com/BcnBitcoinOnly/signet-playground/blob/master/compose.yml) repository.
52+
For an example on how to use this image refer to the `miner` service in the compose.yml file of the [signet-playground](https://github.com/BcnBitcoinOnly/signet-playground/blob/master/compose.yml) repository.

autotools/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,12 @@ FROM alpine:3.22 AS final
8282
ARG KNOTS_VERSION
8383

8484
COPY --from=builder /usr/local/bin/* /usr/local/bin/
85-
COPY --from=builder /tmp/bitcoin-${KNOTS_VERSION}/test/functional/test_framework /opt/bitcoin/test/functional/test_framework
86-
COPY --from=builder /tmp/bitcoin-${KNOTS_VERSION}/contrib/signet/miner /opt/bitcoin/contrib/signet/miner
8785

8886
RUN apk add --no-cache \
89-
python3 \
9087
tor \
9188
&& adduser -D bitcoin \
9289
&& mkdir /home/bitcoin/.bitcoin \
93-
&& chown bitcoin:bitcoin /home/bitcoin/.bitcoin \
94-
&& ln -s /opt/bitcoin/contrib/signet/miner /usr/local/bin/miner
90+
&& chown bitcoin:bitcoin /home/bitcoin/.bitcoin
9591

9692
USER bitcoin
9793

cmake/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,12 @@ FROM alpine:3.22 AS final
6262
ARG KNOTS_VERSION
6363

6464
COPY --from=builder /usr/local/bin/* /usr/local/bin/
65-
COPY --from=builder /tmp/bitcoin-${KNOTS_VERSION}/test/functional/test_framework /opt/bitcoin/test/functional/test_framework
66-
COPY --from=builder /tmp/bitcoin-${KNOTS_VERSION}/contrib/signet/miner /opt/bitcoin/contrib/signet/miner
6765

6866
RUN apk add --no-cache \
69-
python3 \
7067
tor \
7168
&& adduser -D bitcoin \
7269
&& mkdir /home/bitcoin/.bitcoin \
73-
&& chown bitcoin:bitcoin /home/bitcoin/.bitcoin \
74-
&& ln -s /opt/bitcoin/contrib/signet/miner /usr/local/bin/miner
70+
&& chown bitcoin:bitcoin /home/bitcoin/.bitcoin
7571

7672
USER bitcoin
7773

docker-bake.hcl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ variable "VERSION" {
3636
}
3737

3838
group "default" {
39-
targets = ["knots"]
39+
targets = ["knots", "miner"]
4040
}
4141

4242
target "knots" {
@@ -51,3 +51,17 @@ target "knots" {
5151
}]
5252
tags = ["ghcr.io/bcnbitcoinonly/bitcoin:v${VERSION}-${RUNNER}"]
5353
}
54+
55+
target "miner" {
56+
args = {
57+
KNOTS_VERSION = "29.2.knots20251110"
58+
}
59+
context = "miner"
60+
cache-to = [{type = "inline"}]
61+
cache-from = [{
62+
type = "registry"
63+
ref = "1maa/bitcoin:signet-miner"
64+
}]
65+
platforms = ["linux/amd64", "linux/arm64"]
66+
tags = ["1maa/bitcoin:signet-miner"]
67+
}

miner/Dockerfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM alpine:3.23 AS verifier
2+
3+
ARG KNOTS_VERSION
4+
5+
WORKDIR /tmp
6+
7+
RUN KNOTS_MAJOR_VERSION=$(echo ${KNOTS_VERSION} | cut -c1-2) \
8+
&& wget https://bitcoinknots.org/files/${KNOTS_MAJOR_VERSION}.x/${KNOTS_VERSION}/SHA256SUMS \
9+
&& wget https://bitcoinknots.org/files/${KNOTS_MAJOR_VERSION}.x/${KNOTS_VERSION}/SHA256SUMS.asc \
10+
&& wget https://bitcoinknots.org/files/${KNOTS_MAJOR_VERSION}.x/${KNOTS_VERSION}/bitcoin-${KNOTS_VERSION}.tar.gz
11+
12+
RUN apk add --no-cache \
13+
coreutils \
14+
curl \
15+
gnupg \
16+
jq \
17+
&& curl -s https://api.github.com/repos/bitcoinknots/guix.sigs/contents/builder-keys | jq -r '.[].download_url' | while read url; do curl -s "$url" | gpg --import; done \
18+
&& gpg --verify SHA256SUMS.asc SHA256SUMS \
19+
&& sha256sum --ignore-missing -c SHA256SUMS
20+
21+
RUN tar zxf bitcoin-${KNOTS_VERSION}.tar.gz \
22+
&& mv bitcoin-${KNOTS_VERSION} bitcoin
23+
24+
25+
FROM alpine:3.23 AS final
26+
27+
ENV CLI_CMD=bitcoin-cli
28+
ENV MINING_XPUB=tr(tpubXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/0/*)#xxxxxxxx
29+
30+
COPY --from=1maa/bitcoin:latest /usr/local/bin/bitcoin-cli /usr/local/bin/bitcoin-cli
31+
COPY --from=1maa/bitcoin:latest /usr/local/bin/bitcoin-util /usr/local/bin/bitcoin-util
32+
33+
COPY --from=verifier /tmp/bitcoin/test/functional/test_framework /usr/local/src/bitcoin/test/functional/test_framework
34+
COPY --from=verifier /tmp/bitcoin/contrib/signet/miner /usr/local/src/bitcoin/contrib/signet/miner
35+
36+
COPY --chown=0:0 --chmod=755 entrypoint.sh /opt/entrypoint.sh
37+
38+
RUN apk add --no-cache \
39+
python3 \
40+
&& adduser -D bitcoin \
41+
&& ln -s /usr/local/src/bitcoin/contrib/signet/miner /usr/local/bin/miner
42+
43+
USER bitcoin
44+
45+
STOPSIGNAL SIGINT
46+
47+
ENTRYPOINT ["/opt/entrypoint.sh"]

miner/entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
exec /usr/local/bin/miner \
4+
--cli="${CLI_CMD}" \
5+
generate \
6+
--descriptor "${MINING_XPUB}" \
7+
--grind-cmd="bitcoin-util grind" \
8+
--min-nbits \
9+
--ongoing

0 commit comments

Comments
 (0)