Skip to content

Commit 6b059d3

Browse files
authored
Merge pull request #68 from willcl-ark/30.2
2 parents 2c89adc + 5640986 commit 6b059d3

File tree

10 files changed

+263
-7
lines changed

10 files changed

+263
-7
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
pull_request:
66
paths:
7-
- '30.2rc1/**'
7+
- '30.2/**'
88
- '29.2/**'
99
- '28.3/**'
1010
- '27.2/**'
@@ -15,8 +15,8 @@ jobs:
1515
strategy:
1616
matrix:
1717
version:
18-
- '30.2rc1/alpine'
19-
- '30.2rc1'
18+
- '30.2/alpine'
19+
- '30.2'
2020
fail-fast: true
2121
steps:
2222
- name: Checkout

30.2/Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
FROM debian:bookworm-slim AS builder
2+
3+
LABEL maintainer.0="Will Clark (@willcl-ark)"
4+
5+
RUN apt-get update -y \
6+
&& apt-get install -y ca-certificates curl git gnupg gosu python3 wget --no-install-recommends \
7+
&& apt-get clean \
8+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
9+
10+
ARG TARGETPLATFORM
11+
ENV BITCOIN_VERSION=30.2
12+
ENV SIGS_REPO_URL="https://github.com/bitcoin-core/guix.sigs.git"
13+
ENV SIGS_CLONE_DIR="guix.sigs"
14+
ENV VERIFY_SCRIPT_URL="https://raw.githubusercontent.com/bitcoin/bitcoin/v${BITCOIN_VERSION}/contrib/verify-binaries/verify.py"
15+
ENV TMPDIR="/tmp/bitcoin_verify_binaries"
16+
17+
RUN set -ex \
18+
&& if echo $BITCOIN_VERSION | grep -q "rc" ; then \
19+
VERIFY_VERSION=$(echo $BITCOIN_VERSION | sed 's/\(.*\)rc\([0-9]*\)/\1-rc\2/'); \
20+
else \
21+
VERIFY_VERSION=$BITCOIN_VERSION; \
22+
fi \
23+
&& echo "$VERIFY_VERSION" \
24+
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=x86_64-linux-gnu; fi \
25+
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=aarch64-linux-gnu; fi \
26+
&& if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then export TARGETPLATFORM=arm-linux-gnueabihf; fi \
27+
&& git clone ${SIGS_REPO_URL} ${SIGS_CLONE_DIR} \
28+
&& gpg --import "${SIGS_CLONE_DIR}"/builder-keys/* \
29+
&& curl -o verify.py ${VERIFY_SCRIPT_URL} \
30+
&& chmod +x verify.py \
31+
&& ./verify.py \
32+
--min-good-sigs 6 pub "${VERIFY_VERSION}-${TARGETPLATFORM}" \
33+
&& tar -xzf "${TMPDIR}.${VERIFY_VERSION}-${TARGETPLATFORM}/bitcoin-${BITCOIN_VERSION}-${TARGETPLATFORM}.tar.gz" -C /opt \
34+
&& rm -rf ${SIGS_CLONE_DIR} \
35+
&& rm -rf ${TMPDIR} \
36+
&& rm -rf /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-qt
37+
38+
# Second stage
39+
FROM debian:bookworm-slim
40+
41+
ARG UID=101
42+
ARG GID=101
43+
44+
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
45+
ENV BITCOIN_VERSION=30.2
46+
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH
47+
48+
RUN groupadd --gid ${GID} bitcoin \
49+
&& if echo "$BITCOIN_VERSION" | grep -q "rc"; then \
50+
PADDED_VERSION=$(echo $BITCOIN_VERSION | sed 's/\([0-9]\+\)\.\([0-9]\+\)rc/\1.\2.0rc/'); \
51+
else \
52+
PADDED_VERSION=$BITCOIN_VERSION; \
53+
fi \
54+
&& echo "Padded version: $PADDED_VERSION" \
55+
&& useradd --create-home --no-log-init -u ${UID} -g ${GID} bitcoin \
56+
&& apt-get update -y \
57+
&& apt-get install -y gosu --no-install-recommends \
58+
&& apt-get clean \
59+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
60+
61+
COPY --from=builder /opt/bitcoin-${BITCOIN_VERSION} /opt/bitcoin-${BITCOIN_VERSION}
62+
63+
COPY docker-entrypoint.sh /entrypoint.sh
64+
65+
VOLUME ["/home/bitcoin/.bitcoin"]
66+
EXPOSE 8332 8333 18332 18333 18443 18444 38333 38332
67+
68+
ENTRYPOINT ["/entrypoint.sh"]
69+
RUN bitcoind -version | grep "Bitcoin Core daemon version v${PADDED_VERSION}"
70+
CMD ["bitcoind"]

30.2/alpine/Dockerfile

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Build stage for Bitcoin Core
2+
FROM alpine:3.22 AS build
3+
4+
ENV CLANG_V=20
5+
6+
RUN apk --no-cache add \
7+
boost-dev \
8+
build-base \
9+
capnproto \
10+
capnproto-dev \
11+
"clang${CLANG_V}" \
12+
cmake \
13+
file \
14+
git \
15+
gnupg \
16+
libevent-dev \
17+
linux-headers \
18+
pkgconf \
19+
python3 \
20+
sqlite-dev \
21+
zeromq-dev
22+
23+
ENV BITCOIN_VERSION=30.2
24+
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
25+
ENV BITCOIN_SOURCE_DIR=/bitcoin/src
26+
ENV SIGS_REPO_URL="https://github.com/bitcoin-core/guix.sigs.git"
27+
ENV SIGS_CLONE_DIR="guix.sigs"
28+
ENV VERIFY_SCRIPT_URL="https://raw.githubusercontent.com/bitcoin/bitcoin/v${BITCOIN_VERSION}/contrib/verify-binaries/verify.py"
29+
30+
WORKDIR /bitcoin
31+
32+
RUN set -ex \
33+
&& if echo $BITCOIN_VERSION | grep -q "rc" ; then \
34+
VERIFY_VERSION=$(echo $BITCOIN_VERSION | sed 's/\(.*\)rc\([0-9]*\)/\1-rc\2/'); \
35+
ADDRESS="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION%%rc*}/test.rc${BITCOIN_VERSION##*rc}"; \
36+
else \
37+
VERIFY_VERSION=$BITCOIN_VERSION; \
38+
ADDRESS="https://bitcoincore.org/bin/bitcoin-core-${VERIFY_VERSION}"; \
39+
fi \
40+
&& echo "$VERIFY_VERSION" \
41+
&& wget ${ADDRESS}/bitcoin-${BITCOIN_VERSION}.tar.gz \
42+
&& wget ${ADDRESS}/SHA256SUMS \
43+
&& wget ${ADDRESS}/SHA256SUMS.asc \
44+
&& git clone ${SIGS_REPO_URL} ${SIGS_CLONE_DIR} \
45+
&& gpg --import "${SIGS_CLONE_DIR}"/builder-keys/* \
46+
&& wget -O verify.py ${VERIFY_SCRIPT_URL} \
47+
&& chmod +x verify.py \
48+
&& ./verify.py bin SHA256SUMS \
49+
"bitcoin-${BITCOIN_VERSION}.tar.gz" \
50+
&& mkdir -p ${BITCOIN_SOURCE_DIR} \
51+
&& tar -xzf "bitcoin-${BITCOIN_VERSION}.tar.gz" -C ${BITCOIN_SOURCE_DIR} \
52+
&& rm -rf ${SIGS_CLONE_DIR}
53+
54+
WORKDIR "${BITCOIN_SOURCE_DIR}/bitcoin-${BITCOIN_VERSION}"
55+
56+
RUN cmake -B build \
57+
-DBUILD_TESTS=OFF \
58+
-DBUILD_TX=ON \
59+
-DBUILD_UTIL=OFF \
60+
-DCMAKE_BUILD_TYPE=Release \
61+
-DCMAKE_CXX_COMPILER="clang++-${CLANG_V}" \
62+
-DCMAKE_C_COMPILER="clang-${CLANG_V}" \
63+
-DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" && \
64+
cmake --build build -j$(nproc) && \
65+
strip build/bin/bitcoin-cli build/bin/bitcoin-tx build/bin/bitcoind build/bin/bitcoin build/bin/bitcoin-node && \
66+
cmake --install build
67+
68+
# Build stage for compiled artifacts
69+
FROM alpine:3.21
70+
71+
ARG UID=100
72+
ARG GID=101
73+
74+
LABEL maintainer.0="Will Clark (@willcl-ark)"
75+
76+
RUN addgroup bitcoin --gid ${GID} --system
77+
RUN adduser --uid ${UID} --system bitcoin --ingroup bitcoin
78+
RUN apk --no-cache add \
79+
capnproto \
80+
libevent \
81+
libzmq \
82+
shadow \
83+
sqlite-libs \
84+
su-exec
85+
86+
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
87+
ENV BITCOIN_VERSION=30.2
88+
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
89+
ENV PATH=/opt/bin:$PATH
90+
91+
COPY --from=build ${BITCOIN_PREFIX} /opt
92+
COPY docker-entrypoint.sh /entrypoint.sh
93+
94+
RUN if echo "$BITCOIN_VERSION" | grep -q "rc"; then \
95+
PADDED_VERSION=$(echo $BITCOIN_VERSION | sed 's/\([0-9]\+\)\.\([0-9]\+\)rc/\1.\2.0rc/'); \
96+
else \
97+
PADDED_VERSION=$BITCOIN_VERSION; \
98+
fi
99+
100+
VOLUME ["/home/bitcoin/.bitcoin"]
101+
102+
EXPOSE 8332 8333 18332 18333 18444
103+
104+
ENTRYPOINT ["/entrypoint.sh"]
105+
106+
RUN bitcoind -version | grep "Bitcoin Core daemon version v${PADDED_VERSION}"
107+
108+
CMD ["bitcoind"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626

2727
## Tags
2828

29-
- `30.2rc1` ([30.2rc1/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/30.2rc1/Dockerfile)) [**multi-platform**]
30-
- `30.2rc1-alpine` ([30.2rc1/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/30.2rc1/alpine/Dockerfile))
29+
- `30.2`, `30`, `latest` ([30.2/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/30.2/Dockerfile)) [**multi-platform**]
30+
- `30.2-alpine`, `30-alpine`, `alpine` ([30.2/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/30.2/alpine/Dockerfile))
3131

32-
- `29.2`, `29`, `latest` ([29.2/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/29.2/Dockerfile)) [**multi-platform**]
33-
- `29.2-alpine`, `29-alpine`, `alpine` ([29.2/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/29.2/alpine/Dockerfile))
32+
- `29.2`, `29` ([29.2/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/29.2/Dockerfile)) [**multi-platform**]
33+
- `29.2-alpine`, `29-alpine` ([29.2/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/29.2/alpine/Dockerfile))
3434

3535
- `28.3`, `28` ([28.3/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/28.3/Dockerfile)) [**multi-platform**]
3636
- `28.3-alpine`, `28-alpine` ([28.3/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/28.3/alpine/Dockerfile))
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then
5+
usermod -u "$UID" bitcoin
6+
fi
7+
8+
if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then
9+
groupmod -g "$GID" bitcoin
10+
fi
11+
12+
echo "$0: assuming uid:gid for bitcoin:bitcoin of $(id -u bitcoin):$(id -g bitcoin)"
13+
14+
if [ "$(echo "$1" | cut -c1)" = "-" ]; then
15+
echo "$0: assuming arguments for bitcoind"
16+
17+
set -- bitcoind "$@"
18+
fi
19+
20+
if [ "$(echo "$1" | cut -c1)" = "-" ] || [ "$1" = "bitcoind" ]; then
21+
mkdir -p "$BITCOIN_DATA"
22+
chmod 700 "$BITCOIN_DATA"
23+
# Fix permissions for home dir.
24+
chown -R bitcoin:bitcoin "$(getent passwd bitcoin | cut -d: -f6)"
25+
# Fix permissions for bitcoin data dir.
26+
chown -R bitcoin:bitcoin "$BITCOIN_DATA"
27+
28+
echo "$0: setting data directory to $BITCOIN_DATA"
29+
30+
set -- "$@" -datadir="$BITCOIN_DATA"
31+
fi
32+
33+
if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then
34+
echo
35+
exec su-exec bitcoin "$@"
36+
fi
37+
38+
echo
39+
exec "$@"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then
5+
usermod -u "$UID" bitcoin
6+
fi
7+
8+
if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then
9+
groupmod -g "$GID" bitcoin
10+
fi
11+
12+
echo "$0: assuming uid:gid for bitcoin:bitcoin of $(id -u bitcoin):$(id -g bitcoin)"
13+
14+
if [ "$(echo "$1" | cut -c1)" = "-" ]; then
15+
echo "$0: assuming arguments for bitcoind"
16+
17+
set -- bitcoind "$@"
18+
fi
19+
20+
if [ "$(echo "$1" | cut -c1)" = "-" ] || [ "$1" = "bitcoind" ]; then
21+
mkdir -p "$BITCOIN_DATA"
22+
chmod 700 "$BITCOIN_DATA"
23+
# Fix permissions for home dir.
24+
chown -R bitcoin:bitcoin "$(getent passwd bitcoin | cut -d: -f6)"
25+
# Fix permissions for bitcoin data dir.
26+
chown -R bitcoin:bitcoin "$BITCOIN_DATA"
27+
28+
echo "$0: setting data directory to $BITCOIN_DATA"
29+
30+
set -- "$@" -datadir="$BITCOIN_DATA"
31+
fi
32+
33+
if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then
34+
echo
35+
exec gosu bitcoin "$@"
36+
fi
37+
38+
echo
39+
exec "$@"

0 commit comments

Comments
 (0)