Skip to content

Commit eb5a035

Browse files
committed
reimplement signer-miner image variant as a target of the cmake Dockerfile
1 parent 17976f5 commit eb5a035

4 files changed

Lines changed: 53 additions & 68 deletions

File tree

cmake/Dockerfile

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ RUN apk add --no-cache \
1616
jq \
1717
&& 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 \
1818
&& gpg --verify SHA256SUMS.asc SHA256SUMS \
19-
&& sha256sum --ignore-missing -c SHA256SUMS
19+
&& sha256sum --ignore-missing -c SHA256SUMS \
20+
&& tar zxf bitcoin-${KNOTS_VERSION}.tar.gz \
21+
&& mv bitcoin-${KNOTS_VERSION} bitcoin
2022

2123

2224
FROM alpine:3.23 AS builder
@@ -57,6 +59,31 @@ RUN cmake --build build -j $(nproc)
5759
RUN cmake --install build
5860

5961

62+
FROM alpine:3.23 AS signet-miner
63+
64+
ENV CLI_CMD=bitcoin-cli
65+
ENV MINING_XPUB=tr(tpubXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/0/*)#xxxxxxxx
66+
67+
COPY --from=1maa/bitcoin:latest /usr/local/bin/bitcoin-cli /usr/local/bin/bitcoin-cli
68+
COPY --from=1maa/bitcoin:latest /usr/local/bin/bitcoin-util /usr/local/bin/bitcoin-util
69+
70+
COPY --from=verifier /tmp/bitcoin/test/functional/test_framework /usr/local/src/bitcoin/test/functional/test_framework
71+
COPY --from=verifier /tmp/bitcoin/contrib/signet/miner /usr/local/src/bitcoin/contrib/signet/miner
72+
73+
COPY --chown=0:0 --chmod=755 signet-miner-entrypoint.sh /opt/entrypoint.sh
74+
75+
RUN apk add --no-cache \
76+
python3 \
77+
&& adduser -D bitcoin \
78+
&& ln -s /usr/local/src/bitcoin/contrib/signet/miner /usr/local/bin/miner
79+
80+
USER bitcoin
81+
82+
STOPSIGNAL SIGINT
83+
84+
ENTRYPOINT ["/opt/entrypoint.sh"]
85+
86+
6087
FROM alpine:3.23 AS final
6188

6289
ARG KNOTS_VERSION

docker-bake.hcl

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variable "CONTEXT" {
2-
type = string
3-
default = "cmake"
2+
type = string
3+
default = "cmake"
44
description = "autotools up to v28.1.knots20250305, cmake after"
55
validation {
66
condition = contains(["autotools", "cmake"], CONTEXT)
@@ -9,8 +9,8 @@ variable "CONTEXT" {
99
}
1010

1111
variable "RUNNER" {
12-
type = string
13-
default = "ubuntu-24.04"
12+
type = string
13+
default = "ubuntu-24.04"
1414
description = "Runner that built the image"
1515
validation {
1616
condition = contains(["ubuntu-24.04", "ubuntu-24.04-arm"], RUNNER)
@@ -19,8 +19,8 @@ variable "RUNNER" {
1919
}
2020

2121
variable "VERSION" {
22-
type = string
23-
default = "29.2.knots20251110"
22+
type = string
23+
default = "29.2.knots20251110"
2424
description = "Version of Knots to build"
2525
validation {
2626
condition = contains([
@@ -40,27 +40,32 @@ group "default" {
4040

4141
target "knots" {
4242
args = {
43-
KNOTS_VERSION = "${VERSION}"
43+
KNOTS_VERSION = VERSION
4444
}
45-
context = "${CONTEXT}"
46-
cache-to = [{type = "inline"}]
47-
cache-from = [{
48-
type = "registry"
49-
ref = "ghcr.io/bcnbitcoinonly/bitcoin:v${VERSION}-${RUNNER}"
50-
}]
45+
context = CONTEXT
46+
cache-to = [{ type = "inline" }]
47+
cache-from = [
48+
{
49+
type = "registry"
50+
ref = "ghcr.io/bcnbitcoinonly/bitcoin:v${VERSION}-${RUNNER}"
51+
}
52+
]
5153
tags = ["ghcr.io/bcnbitcoinonly/bitcoin:v${VERSION}-${RUNNER}"]
5254
}
5355

5456
target "miner" {
5557
args = {
56-
KNOTS_VERSION = "29.2.knots20251110"
58+
KNOTS_VERSION = VERSION
5759
}
58-
context = "miner"
59-
cache-to = [{type = "inline"}]
60-
cache-from = [{
61-
type = "registry"
62-
ref = "1maa/bitcoin:signet-miner"
63-
}]
60+
context = "cmake"
61+
cache-to = [{ type = "inline" }]
62+
cache-from = [
63+
{
64+
type = "registry"
65+
ref = "1maa/bitcoin:signet-miner"
66+
}
67+
]
6468
platforms = ["linux/amd64", "linux/arm64"]
6569
tags = ["1maa/bitcoin:signet-miner"]
70+
target = "signet-miner"
6671
}

miner/Dockerfile

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)