forked from ruimarinho/docker-bitcoin-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (53 loc) · 2.57 KB
/
Dockerfile
File metadata and controls
71 lines (53 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# syntax=docker/dockerfile:1
FROM debian:bookworm-slim
ARG UID=1001
ARG GID=1001
ARG DEBCONF_NOWARNINGS="yes"
ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NONINTERACTIVE_SEEN="true"
RUN groupadd --gid ${GID} bitcoin \
&& useradd --create-home --no-log-init -u ${UID} -g ${GID} bitcoin \
&& apt-get update -y \
&& apt-get --no-install-recommends -y install jq curl gnupg gosu iputils-ping ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG TARGETPLATFORM
ARG BITCOIN_RC
ARG BITCOIN_VERSION
ARG BITCOIN_BASE=${BITCOIN_VERSION}${BITCOIN_RC}
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV PATH=/opt/bitcoin-${BITCOIN_BASE}/bin:$PATH
SHELL ["/bin/bash", "-c"]
RUN set -eux \
&& if [ -n "${BITCOIN_RC}" ]; then export SUBDIR=/test.; else export SUBDIR=; fi \
&& export URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}${SUBDIR}${BITCOIN_RC}" \
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=x86_64-linux-gnu; fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=aarch64-linux-gnu; fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then export TARGETPLATFORM=arm-linux-gnueabihf; fi \
&& SIGNERS=($(curl -sS "https://api.github.com/repos/bitcoin-core/guix.sigs/contents/${BITCOIN_BASE}" | jq -r '.[] | select(.type=="dir") | .name' | tr "\n" " ")) \
&& for name in "${SIGNERS[@]}"; do \
curl -sSL "https://raw.githubusercontent.com/bitcoin-core/guix.sigs/main/builder-keys/${name}.gpg" | gpg --import - ; \
done \
&& curl -SLO "${URL}/bitcoin-${BITCOIN_BASE}-${TARGETPLATFORM}.tar.gz" \
&& curl -SLO "${URL}/SHA256SUMS" \
&& curl -SLO "${URL}/SHA256SUMS.asc" \
&& gpg --verify SHA256SUMS.asc SHA256SUMS \
&& grep " bitcoin-${BITCOIN_BASE}-${TARGETPLATFORM}.tar.gz" SHA256SUMS | sha256sum -c - \
&& tar -xzf ./*.tar.gz -C /opt \
&& rm ./*.tar.gz ./*.asc \
&& rm -rf "/opt/bitcoin-${BITCOIN_BASE}/bin/bitcoin-qt" \
&& rm -rf "/opt/bitcoin-${BITCOIN_BASE}/bin/test_bitcoin"
COPY --chmod=755 entrypoint.sh /entrypoint.sh
VOLUME ["/home/bitcoin/.bitcoin"]
# REST interface
EXPOSE 8080
# P2P network (mainnet, testnet & regnet respectively)
EXPOSE 8333 18333 18444
# RPC interface (mainnet, testnet & regnet respectively)
EXPOSE 8332 18332 18443
# ZMQ ports (for transactions & blocks respectively)
EXPOSE 28332 28333
HEALTHCHECK --interval=300s --start-period=60s --start-interval=10s --timeout=20s CMD gosu bitcoin bitcoin-cli -rpcwait -getinfo || exit 1
ENTRYPOINT ["/entrypoint.sh"]
RUN bitcoind -version | grep "version v${BITCOIN_VERSION}"
CMD ["bitcoind"]