-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
109 lines (92 loc) · 3.22 KB
/
Dockerfile
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
RUN apk --no-cache add autoconf
RUN apk --no-cache add automake
RUN apk --no-cache add boost-dev
RUN apk --no-cache add build-base
RUN apk --no-cache add chrpath
RUN apk --no-cache add file
RUN apk --no-cache add gnupg
RUN apk --no-cache add git
RUN apk --no-cache add libevent-dev
RUN apk --no-cache add libressl
RUN apk --no-cache add libtool
RUN apk --no-cache add linux-headers
RUN apk --no-cache add sqlite-dev
RUN apk --no-cache add zeromq-dev
ENV BITCOIN_VERSION=26.2
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
ENV BITCOIN_SOURCE_DIR=/bitcoin/src
ENV SIGS_REPO_URL="https://github.com/bitcoin-core/guix.sigs.git"
ENV SIGS_CLONE_DIR="guix.sigs"
ENV VERIFY_SCRIPT_URL="https://github.com/bitcoin/bitcoin/raw/master/contrib/verify-binaries/verify.py"
WORKDIR /bitcoin
RUN set -ex \
&& if echo $BITCOIN_VERSION | grep -q "rc" ; then \
VERIFY_VERSION=$(echo $BITCOIN_VERSION | sed 's/\(.*\)rc\([0-9]*\)/\1-rc\2/'); \
ADDRESS="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION%%rc*}/test.rc${BITCOIN_VERSION##*rc}"; \
else \
VERIFY_VERSION=$BITCOIN_VERSION; \
ADDRESS="https://bitcoincore.org/bin/bitcoin-core-${VERIFY_VERSION}"; \
fi \
&& echo "$VERIFY_VERSION" \
&& wget ${ADDRESS}/bitcoin-${BITCOIN_VERSION}.tar.gz \
&& wget ${ADDRESS}/SHA256SUMS \
&& wget ${ADDRESS}/SHA256SUMS.asc \
&& git clone ${SIGS_REPO_URL} ${SIGS_CLONE_DIR} \
&& gpg --import "${SIGS_CLONE_DIR}"/builder-keys/* \
&& wget -O verify.py ${VERIFY_SCRIPT_URL} \
&& chmod +x verify.py \
&& ./verify.py bin SHA256SUMS \
"bitcoin-${BITCOIN_VERSION}.tar.gz" \
&& mkdir -p ${BITCOIN_SOURCE_DIR} \
&& tar -xzf "bitcoin-${BITCOIN_VERSION}.tar.gz" -C ${BITCOIN_SOURCE_DIR} \
&& rm -rf ${SIGS_CLONE_DIR}
WORKDIR "${BITCOIN_SOURCE_DIR}/bitcoin-${BITCOIN_VERSION}"
RUN ./autogen.sh
RUN ./configure \
--prefix=${BITCOIN_PREFIX} \
--mandir=/usr/share/man \
--disable-tests \
--disable-bench \
--disable-fuzz-binary \
--disable-ccache \
--with-gui=no \
--with-utils \
--without-libs \
--with-sqlite=yes \
--with-daemon
RUN make -j`nproc` -C src bitcoind bitcoin-cli bitcoin-tx
RUN make -j`nproc` install
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
# Build stage for compiled artifacts
FROM alpine
ARG UID=100
ARG GID=101
LABEL maintainer.0="Will Clark (@willcl-ark)"
RUN addgroup bitcoin --gid ${GID} --system
RUN adduser --uid ${UID} --system bitcoin --ingroup bitcoin
RUN apk --no-cache add \
libevent \
libzmq \
shadow \
sqlite-libs \
su-exec
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=26.2
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
ENV PATH=${BITCOIN_PREFIX}/bin:$PATH
COPY --from=bitcoin-core /opt /opt
COPY docker-entrypoint.sh /entrypoint.sh
RUN if echo "$BITCOIN_VERSION" | grep -q "rc"; then \
PADDED_VERSION=$(echo $BITCOIN_VERSION | sed 's/\([0-9]\+\)\.\([0-9]\+\)rc/\1.\2.0rc/'); \
else \
PADDED_VERSION=$BITCOIN_VERSION; \
fi
VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18444
ENTRYPOINT ["/entrypoint.sh"]
RUN bitcoind -version | grep "Bitcoin Core version v${PADDED_VERSION}"
CMD ["bitcoind"]