forked from bitcoinerlab/tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
142 lines (114 loc) · 4.31 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# -------------------------------------------------------
# Dockerfile for RewindBitcoin's Tape
# -------------------------------------------------------
#
# Quick Guide:
# 1. Building a Local Image:
# $ docker build -t bitcoinerlab/tape .
#
# 2. Building for Multiple Platforms & Uploading to Docker Hub:
# a. Login to Docker Hub:
# $ docker login -u bitcoinerlab
#
# b. Set up for multi-platform builds:
# $ docker buildx create --use
#
# c. Build & Push to Docker Hub:
# $ docker buildx build --platform linux/amd64,linux/arm64 -t bitcoinerlab/tape . --push
#
# 3. Creating a Docker Volume for Persistent Data:
# Create a Docker volume to store the blockchain, indexes, and regtest files:
# $ docker volume create tape_data
#
# This volume will be used to store the following directories:
# - `/root/tape-volume/bitcoin` : Bitcoin Core blockchain and wallet data
# - `/root/tape-volume/electrs` : Electrs index data
# - `/root/tape-volume/bitcoinjs-regtest-server-data` : BitcoinJS server data
#
# 4. Running the Image:
# $ docker run --name bitcoinerlab_tape_instance -v tape_data:/root/tape-volume -d -p 8080:8080 -p 60401:60401 -p 3002:3002 bitcoinerlab/tape
#
# If you get random GPG signature errors, clear Docker cache:
# $ docker builder prune
#
# If you get resource exhausted errors, try restarting docker and deleting old images/volumes, then:
# $ docker system prune -a --volumes
# Use Ubuntu 24.04 LTS as the base image
FROM ubuntu:24.04
# Set a maintainer label
LABEL maintainer="[email protected]"
# Avoid user interaction when installing packages
ENV DEBIAN_FRONTEND=noninteractive
# Update packages and install essential ones
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
vim \
wget
# Set the working directory
WORKDIR /root
# Start bash shell by default when a container starts
CMD ["/bin/bash"]
## I 'll need:
## --enable-txindex
## --with-zmq
#See: doc/build-unix.md
RUN apt-get install -y build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 &&\
apt-get install -y libevent-dev libboost-dev &&\
apt install -y libsqlite3-dev
#we'll need zmq support
RUN apt-get install -y libzmq3-dev
RUN wget https://bitcoincore.org/bin/bitcoin-core-27.1/bitcoin-27.1.tar.gz &&\
tar zxvf bitcoin-27.1.tar.gz
WORKDIR /root/bitcoin-27.1
# Modify chainparams.cpp before compiling so regtest has same halving as mainnet and we can be rich in regtest too
RUN sed -i 's/consensus.nSubsidyHalvingInterval = 150;/consensus.nSubsidyHalvingInterval = 210000;/' src/kernel/chainparams.cpp
RUN ./autogen.sh &&\
./configure --without-gui --enable-zmq --enable-txindex --disable-bdb --disable-tests --disable-gui-tests --disable-bench --prefix=/usr &&\
make -j 4 &&\
make install
WORKDIR /root
RUN curl --silent --location https://deb.nodesource.com/setup_20.x | bash - &&\
apt-get install -y nodejs
RUN mkdir /root/regtest-data && \
echo "satoshi" > /root/regtest-data/KEYS
COPY run.sh run_bitcoind_service.sh install_leveldb.sh ./
RUN chmod +x install_leveldb.sh && \
chmod +x run_bitcoind_service.sh && \
chmod +x run.sh && \
./install_leveldb.sh
RUN git clone -b fix-bitcoinjs-lib-version https://github.com/bitcoinerlab/regtest-server.git
WORKDIR /root/regtest-server
# Change the checkout branch if you need to. Must fetch because of Docker cache
# RUN git fetch origin && \
# git checkout ebee446d7c3b9071633764b39cdca3ac1b28d253
RUN npm i
# Install Blockstream electrs (rust & other dependencies)
WORKDIR /root
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN apt install -y git clang
RUN git clone https://github.com/blockstream/electrs
WORKDIR /root/electrs
RUN git checkout new-index
RUN cargo build --release
ENV PATH="/root/electrs/target/release:${PATH}"
# Expose electrs & esplora ports
EXPOSE 60401 3002
# Clone and setup Esplora
WORKDIR /root
ENV COMMIT_SHA=9067d8bf4323d8fea4cbf637b7c11ebc528d56e5
RUN git clone https://github.com/Blockstream/esplora
WORKDIR /root/esplora
RUN git checkout ${COMMIT_SHA}
RUN npm install --unsafe-perm
# Environment variable to allow CORS from any domain for Esplora
ENV CORS_ALLOW=*
# The esplora server:
ENV API_URL="http://localhost:3002"
# Expose Esplora server
EXPOSE 5000
ENTRYPOINT ["/root/run.sh"]
# Expose regtest-server
EXPOSE 8080