1
- ARG ARCH="amd64"
2
1
ARG VERSION="0.19.1"
3
2
4
3
ARG LEGACY_BITCOIN_CORE_RELEASE_KEY="01EA5486DE18A882D4C2684590C8019E36C2E964"
@@ -12,34 +11,53 @@ ARG PIETER_WUILLE="133EAC179436F14A5CF1B794860FEB804E669320"
12
11
ARG SJORS_PROVOOST="ED9BDF7AD6A55E232E84524257FF9BDBCC301009"
13
12
ARG KEYS="${LEGACY_BITCOIN_CORE_RELEASE_KEY} ${ANDREW_CHOW} ${JON_ATACK} ${JONAS_SCHNELLI} ${MATT_CORALLO} ${LUKE_DASHJR} ${PETER_TODD} ${PIETER_WUILLE} ${SJORS_PROVOOST}"
14
13
15
- FROM $ARCH/debian:stable-slim
14
+ # Build stage
15
+ FROM --platform=$BUILDPLATFORM debian:stable-slim as builder
16
16
LABEL maintainer=
"Luke Childs <[email protected] >"
17
17
18
+ ARG TARGETARCH
19
+
18
20
ARG ARCH
19
21
ARG VERSION
20
22
ARG KEYS
21
23
22
- RUN cd /tmp && \
23
- if [ "${ARCH}" = "amd64" ]; then TARBALL_ARCH=x86_64-linux-gnu; fi && \
24
- if [ "${ARCH}" = "arm64v8" ]; then TARBALL_ARCH=aarch64-linux-gnu; fi && \
25
- if [ "${ARCH}" = "arm32v7" ]; then TARBALL_ARCH=arm-linux-gnueabihf; fi && \
26
- TARBALL="bitcoin-${VERSION}-${TARBALL_ARCH}.tar.gz" && \
27
- apt-get update && \
28
- apt-get install -y wget gpg && \
29
- wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/${TARBALL} && \
30
- # This file only exists after v22
31
- wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS || true && \
32
- wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS.asc && \
33
- gpg --keyserver keyserver.ubuntu.com --recv-keys $KEYS && \
34
- gpg --verify SHA256SUMS.asc 2>&1 >/dev/null | grep "^gpg: Good signature from" || { echo "No valid signature" ; exit 1; } && \
35
- if [ -f SHA256SUMS ]; then CHECKSUM_FILE="SHA256SUMS" ; else CHECKSUM_FILE="SHA256SUMS.asc" ; fi && \
36
- grep $TARBALL $CHECKSUM_FILE | sha256sum -c && \
37
- # sha256sum -c --ignore-missing "${CHECKSUM_FILE}" \
38
- tar -zxvf $TARBALL --strip-components=1 && \
39
- mv bin/bitcoind /usr/local/bin/ && \
40
- mv bin/bitcoin-cli /usr/local/bin/ && \
41
- apt-get purge -y wget gpg && \
42
- apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
24
+ WORKDIR /build
25
+
26
+ RUN echo "Installing build deps"
27
+ RUN apt-get update
28
+ RUN apt-get install -y wget pgp
29
+
30
+ RUN echo "Deriving tarball name from \$ TARGETARCH"
31
+ RUN [ "${TARGETARCH}" = "amd64" ] && echo "bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz" > /tarball-name || true
32
+ RUN [ "${TARGETARCH}" = "arm64" ] && echo "bitcoin-${VERSION}-aarch64-linux-gnu.tar.gz" > /tarball-name || true
33
+ RUN [ "${TARGETARCH}" = "arm" ] && echo "bitcoin-${VERSION}-arm-linux-gnueabihf.tar.gz" > /tarball-name || true
34
+ RUN echo "Tarball name: $(cat /tarball-name)"
35
+
36
+ RUN echo "Downloading release assets"
37
+ RUN wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/$(cat /tarball-name)
38
+ RUN wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS.asc
39
+ # This file only exists after v22 so allow it to fail
40
+ RUN wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS || true
41
+ RUN echo "Downloaded release assets:" && ls
42
+
43
+ RUN echo "Verifying PGP signatures"
44
+ RUN gpg --keyserver keyserver.ubuntu.com --recv-keys $KEYS
45
+ RUN gpg --verify SHA256SUMS.asc 2>&1 >/dev/null | grep "^gpg: Good signature from" || { echo "No valid signature" ; exit 1; }
46
+ RUN echo "PGP signature verification passed"
47
+
48
+ RUN echo "Verifying checksums"
49
+ RUN [ -f SHA256SUMS ] && cp SHA256SUMS /sha256sums || cp SHA256SUMS.asc /sha256sums
50
+ RUN grep $(cat /tarball-name) /sha256sums | sha256sum -c
51
+ RUN echo "Chucksums verified ok"
52
+
53
+ RUN echo "Extracting release assets"
54
+ RUN tar -zxvf $(cat /tarball-name) --strip-components=1
55
+
56
+ # Final image
57
+ FROM debian:stable-slim
58
+
59
+ COPY --from=builder /build/bin/bitcoind /bin
60
+ COPY --from=builder /build/bin/bitcoin-cli /bin
43
61
44
62
ENV HOME /data
45
63
VOLUME /data/.bitcoin
0 commit comments