-
Notifications
You must be signed in to change notification settings - Fork 406
/
Dockerfile.deps
92 lines (80 loc) · 4.79 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
# Build libwally wasm files. Used for client-side blinding verification on Elements-based chains
FROM blockstream/wallycore@sha256:62cc52bd3ad9176b55cb486482368f858a4debee248a15d2fada0a62eb074a05 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:bookworm-slim
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.40.1 https://github.com/nvm-sh/nvm.git /root/.nvm \
&& rm -rf /root/.nvm/.git \
&& source /root/.nvm/nvm.sh \
&& nvm install v18.20.4
ARG TARGETARCH
ENV SHA256SUM_ELEMENTS_X86_64="6e0c747ec4ba4e54eb3426e7219354b5ea150b393a4e2b8a536cab64a5d9c7a8"
ENV SHA256SUM_ELEMENTS_ARM64="5c6f8219fd1baf4d4c2b05b6dd9ec71bb348754bd46aeb3faa7ba0ba69aff0e8"
ENV SHA256SUM_BITCOINCORE_X86_64="2a6974c5486f528793c79d42694b5987401e4a43c97f62b1383abf35bcee44a8"
ENV SHA256SUM_BITCOINCORE_ARM64="cb35e250ae9d0328aa90e7aad0b877ed692597420a1092e8ab1a5dd756209722"
ENV VERSION_BITCOINCORE=27.0
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
curl -sL -o bitcoin.tar.gz "https://bitcoincore.org/bin/bitcoin-core-${VERSION_BITCOINCORE}/bitcoin-${VERSION_BITCOINCORE}-aarch64-linux-gnu.tar.gz"; \
echo "${SHA256SUM_BITCOINCORE_ARM64} bitcoin.tar.gz" | sha256sum --check; \
else \
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_X86_64} bitcoin.tar.gz" | sha256sum --check; \
fi \
&& tar xzf bitcoin.tar.gz -C /srv/explorer \
&& ln -s "/srv/explorer/bitcoin-${VERSION_BITCOINCORE}" /srv/explorer/bitcoin \
&& rm bitcoin.tar.gz
ENV VERSION_ELEMENTS=23.2.4
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
curl -sL -o elements.tar.gz "https://github.com/ElementsProject/elements/releases/download/elements-${VERSION_ELEMENTS}/elements-${VERSION_ELEMENTS}-aarch64-linux-gnu.tar.gz"; \
echo "${SHA256SUM_ELEMENTS_ARM64} elements.tar.gz" | sha256sum --check; \
else \
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_X86_64} elements.tar.gz" | sha256sum --check; \
fi \
&& 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 306f66acf2ab10bcd99b8012e95a0de30b2cc012 \
&& 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