forked from Blockstream/esplora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.deps
97 lines (85 loc) · 5.16 KB
/
Dockerfile.deps
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
# Build libwally wasm files. Used for client-side blinding verification on Elements-based chains
FROM greenaddress/wallycore@sha256:d63d222be12f6b2535e1548aa7f21cf649e2230d6c9e01bd518c23eb0bccd46f AS libwally-wasm
ARG NO_LIQUID
ENV EXPORTED_FUNCTIONS="['_malloc', '_free', '_wally_init','_wally_asset_value_commitment','_wally_asset_generator_from_bytes']"
ENV EXTRA_EXPORTED_RUNTIME_METHODS="['getValue', 'ccall']"
ENV EMCC_OPTIONS="-s MODULARIZE=1 -s EXPORT_NAME=InitWally"
RUN sh -c '[ -n "$NO_LIQUID" ] && mkdir -p /wally/wally_dist || ( \
cd /opt/emsdk && . ./emsdk_env.sh \
&& git clone --no-checkout https://github.com/elementsproject/libwally-core /wally \
&& cd /wally && git checkout ea984fc07f4f450b33d4eb78756f25f553e60b44 \
&& git submodule sync --recursive && git submodule update --init --recursive \
&& ./tools/build_wasm.sh --enable-elements)'
FROM debian:bullseye@sha256:4d6ab716de467aad58e91b1b720f0badd7478847ec7a18f66027d0f8a329a43c
SHELL ["/bin/bash", "-c"]
ENV CORE_BUILD_DEPS="autoconf autotools-dev automake libtool pkg-config bsdmainutils build-essential"
ENV ESPLORA_BUILD_DEPS="clang cmake curl git"
RUN mkdir -p /srv/explorer \
&& apt-get -yqq update \
&& apt-get -yqq upgrade \
&& apt-get -yqq install ${ESPLORA_BUILD_DEPS} tor ${CORE_BUILD_DEPS}
RUN git clone --quiet --depth 1 --single-branch --branch v0.39.0 https://github.com/nvm-sh/nvm.git /root/.nvm \
&& rm -rf /root/.nvm/.git \
&& source /root/.nvm/nvm.sh \
&& nvm install v17.1.0
# Build core from sources until PR https://github.com/bitcoin/bitcoin/pull/23387 is merged
ENV CORE_PATCH=contrib/0001-add-support-to-save-fee-estimates-without-shutting-d.patch
ENV CORE_SRC=/root/bitcoin
COPY ${CORE_PATCH} /${CORE_PATCH}
RUN git clone --quiet --depth 1 --branch v24.1 --single-branch --recursive https://github.com/bitcoin/bitcoin.git ${CORE_SRC} \
&& (cd ${CORE_SRC} \
&& git checkout 3116ccd790e76de8f64d2ef9aa5a2641c15bbd8b \
&& git apply /${CORE_PATCH} \
&& (cd depends \
&& make HOST=x86_64-pc-linux-gnu NO_QT=1 -j $(nproc --all)) \
&& ./autogen.sh \
&& CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure --prefix=/srv/explorer/bitcoin --disable-man --disable-zmq --disable-qt --disable-gui-tests --disable-bench \
--enable-experimental-asm --without-utils --enable-util-cli --without-libs --with-daemon --disable-maintainer-mode \
--disable-glibc-back-compat --disable-ccache --disable-dependency-tracking --disable-tests --with-gui=no \
&& make -j $(nproc --all) \
&& make install -j $(nproc --all) \
&& strip /srv/explorer/bitcoin/bin/* \
&& rm -fr ${CORE_SRC} /${CORE_PATCH})
#ENV SHA256SUM_BITCOINCORE=59ebd25dd82a51638b7a6bb914586201e67db67b919b2a1ff08925a7936d1b16
#ENV VERSION_BITCOINCORE=22.0
#RUN curl -sL -o bitcoin.tar.gz "https://bitcoincore.org/bin/bitcoin-core-${VERSION_BITCOINCORE}/bitcoin-${VERSION_BITCOINCORE}-x86_64-linux-gnu.tar.gz" \
# && echo "${SHA256SUM_BITCOINCORE} bitcoin.tar.gz" | sha256sum --check \
# && tar xzf bitcoin.tar.gz -C /srv/explorer \
# && ln -s "/srv/explorer/bitcoin-${VERSION_BITCOINCORE}" /srv/explorer/bitcoin \
# && rm bitcoin.tar.gz
ENV SHA256SUM_ELEMENTS=67aca46c12b8a81c960798502f81463b18c54d3ebd5c0804b26f1a336d148042
ENV VERSION_ELEMENTS=22.1.1
RUN curl -sL -o elements.tar.gz "https://github.com/ElementsProject/elements/releases/download/elements-${VERSION_ELEMENTS}/elements-${VERSION_ELEMENTS}-x86_64-linux-gnu.tar.gz" \
&& echo "${SHA256SUM_ELEMENTS} elements.tar.gz" | sha256sum --check \
&& tar xzf elements.tar.gz -C /srv/explorer \
&& ln -s "/srv/explorer/elements-${VERSION_ELEMENTS}" /srv/explorer/liquid \
&& mv /srv/explorer/liquid/bin/{elementsd,liquidd} \
&& mv /srv/explorer/liquid/bin/{elements-cli,liquid-cli} \
&& rm elements.tar.gz
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.75.0
RUN source /root/.cargo/env \
&& mkdir -p /srv/explorer/electrs{,_liquid} \
&& git clone --no-checkout https://github.com/blockstream/electrs.git \
&& (cd electrs \
&& git checkout efc1fec8b0f96b5663d7257a0c2cffd8ef143219 \
&& cp contrib/popular-scripts.txt /srv/explorer \
&& cargo install --root /srv/explorer/electrs_bitcoin --locked --path . --features electrum-discovery \
&& cargo install --root /srv/explorer/electrs_liquid --locked --path . --features electrum-discovery,liquid \
) \
&& rm -fr electrs \
&& strip /srv/explorer/electrs_*/bin/electrs
# Install websocat v1.9.0 with none of the default features, which aren't needed (ssl, subprocess support and stdio support)
RUN source /root/.cargo/env \
&& git clone --no-checkout https://github.com/vi/websocat \
&& (cd websocat \
&& git checkout 9f301bd82bbb28e385a5020870738f98ab9010b1 \
&& cargo install --root /srv/explorer/websocat --locked --path . --no-default-features \
) \
&& strip /srv/explorer/websocat/bin/websocat \
&& rm -fr /root/.cargo websocat
# cleanup
RUN apt-get --auto-remove remove -yqq --purge ${ESPLORA_BUILD_DEPS} manpages ${CORE_BUILD_DEPS} \
&& apt-get clean \
&& apt-get autoclean \
&& rm -rf /usr/share/doc* /usr/share/man /usr/share/postgresql/*/man /var/lib/apt/lists/* /var/cache/* /tmp/* /root/.cache /*.deb /root/.cargo
COPY --from=libwally-wasm /wally/wally_dist /srv/wally_wasm