2022-09-12 20:01:14 +00:00
|
|
|
# Configure Environment
|
|
|
|
FROM alpine:latest as builder
|
|
|
|
|
2023-10-20 22:52:43 +00:00
|
|
|
ENV BITCOIN_VERSION=25.1
|
2022-09-12 20:01:14 +00:00
|
|
|
|
|
|
|
WORKDIR /home/bitcoin
|
|
|
|
|
2023-09-19 16:55:30 +00:00
|
|
|
RUN apk --no-cache add git gnupg
|
2022-09-12 20:01:14 +00:00
|
|
|
|
2023-07-21 08:27:14 +00:00
|
|
|
# Download Bitcoin
|
2022-09-12 20:01:14 +00:00
|
|
|
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz \
|
2022-12-09 03:10:12 +00:00
|
|
|
&& wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS \
|
|
|
|
&& wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc
|
2022-09-12 20:01:14 +00:00
|
|
|
|
2023-07-21 08:27:14 +00:00
|
|
|
# Verify all sigs and check for a valid signature from laanwj -- 71A3
|
2023-07-19 23:22:49 +00:00
|
|
|
RUN git clone https://github.com/bitcoin-core/guix.sigs && \
|
|
|
|
cd guix.sigs/builder-keys && \
|
|
|
|
find . -iname '*.gpg' -exec gpg --import {} \; && \
|
|
|
|
gpg --verify --status-fd 1 --verify ../../SHA256SUMS.asc ../../SHA256SUMS | grep "^\[GNUPG:\] VALIDSIG.*71A3B16735405025D447E8F274810B012346C9A6"
|
2022-09-12 20:01:14 +00:00
|
|
|
|
|
|
|
RUN grep bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz SHA256SUMS | sha256sum -c
|
|
|
|
|
|
|
|
# Prepare Image
|
|
|
|
RUN tar xzvf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
|
2023-07-30 11:23:14 +00:00
|
|
|
RUN mv bitcoin-${BITCOIN_VERSION}/bin/bitcoind .
|
2022-09-12 20:01:14 +00:00
|
|
|
|
2023-09-19 16:55:30 +00:00
|
|
|
# Also build mimalloc
|
|
|
|
FROM debian:bookworm-slim as mimalloc
|
|
|
|
|
|
|
|
RUN apt update && apt upgrade -y && apt install -y gcc g++ make cmake git
|
|
|
|
RUN git clone https://github.com/microsoft/mimalloc && \
|
|
|
|
cd mimalloc && \
|
|
|
|
mkdir -p out/secure && \
|
|
|
|
cd out/secure && \
|
|
|
|
cmake -DMI_SECURE=ON ../.. && \
|
|
|
|
make && \
|
|
|
|
cp ./libmimalloc-secure.so ../../../libmimalloc.so
|
|
|
|
|
|
|
|
# Build the actual image
|
2023-07-26 07:06:01 +00:00
|
|
|
FROM debian:bookworm-slim as image
|
2023-07-21 08:27:14 +00:00
|
|
|
|
2023-09-19 16:55:30 +00:00
|
|
|
COPY --from=mimalloc libmimalloc.so /usr/lib
|
|
|
|
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload
|
|
|
|
|
2023-07-26 07:06:01 +00:00
|
|
|
# Upgrade packages
|
2023-08-13 09:11:49 +00:00
|
|
|
RUN apt update && apt upgrade -y && apt autoremove -y && apt clean
|
2023-07-26 07:06:01 +00:00
|
|
|
|
2023-07-30 11:23:14 +00:00
|
|
|
# Switch to a non-root user
|
|
|
|
RUN useradd --system --create-home --shell /sbin/nologin bitcoin
|
|
|
|
USER bitcoin
|
|
|
|
WORKDIR /home/bitcoin
|
|
|
|
|
|
|
|
COPY --from=builder --chown=bitcoin /home/bitcoin/bitcoind /bin
|
|
|
|
COPY ./scripts /scripts
|
|
|
|
|
2022-09-12 20:01:14 +00:00
|
|
|
EXPOSE 8332 8333 18332 18333 18443 18444
|
2023-07-30 11:23:14 +00:00
|
|
|
# VOLUME ["/home/bitcoin/.bitcoin"]
|