-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
204 lines (163 loc) · 7.5 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#
# HETMAN IMAGE
#
# Contains:
# Execution:
# - Geth + Bootnode util
#
# Consensus:
# - Lighthouse
# - Lcli
# - Teku
# - Prysm
# Genesis utils:
# - eth2-testnet-genesis
# - ethdo
# - zcli
# - Flashbots Builder
# - Flashbots MEV-Boost
# - Manifold Freelay PBS relay
#
# Base image
ARG DEBIAN_RELEASE="bookworm"
# Lighthouse testnet bakery helper
ARG LCLI_VERSION="5.0.0"
# Ethereum clients
ARG GETH_VERSION="1.13.13"
ARG LIGHTHOUSE_VERSION="5.0.0"
ARG TEKU_VERSION="24.2.0"
ARG MEV_BOOST_VERSION="1.7a1"
# prysm image
FROM bitnami/minideb:${DEBIAN_RELEASE} AS prysmbuilder
# Bazel build wrapper
ARG BAZELISK_VERSION="1.17.0"
ARG BAZELISK_SHA256="61699e22abb2a26304edfa1376f65ad24191f94a4ffed68a58d42b6fee01e124"
ARG PRYSM_REF="refs/tags/v4.2.0"
ENV BAZELISK_VERSION="${BAZELISK_VERSION}"
ENV PRYSM_REF="${PRYSM_REF}"
RUN install_packages curl ca-certificates git openjdk-17-jdk python3 build-essential libssl-dev libgmp-dev libtinfo5
RUN cd /usr/local/bin/ && curl -fsSL "https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64" -O && mv bazelisk-linux-amd64 bazel
RUN echo "${BAZELISK_SHA256} /usr/local/bin/bazel" | sha256sum -c
RUN chmod +x /usr/local/bin/bazel
WORKDIR /usr/local/src/
RUN git clone https://github.com/prysmaticlabs/prysm.git && cd prysm && git fetch origin "${PRYSM_REF}" && git checkout "${PRYSM_REF}"
RUN cd prysm && bazel build //cmd/beacon-chain:beacon-chain --config=minimal
RUN cd prysm && bazel cquery //cmd/beacon-chain:beacon-chain \
--output starlark \
--starlark:expr="target.files.to_list()[0].path" > image.txt
RUN mkdir -p /usr/local/prysm/bin
RUN cp "prysm/$(cat prysm/image.txt)" /usr/local/prysm/bin/beacon-chain
RUN find -L /usr/local/prysm
# builder and relay
FROM bitnami/minideb:${DEBIAN_RELEASE} AS mevbuilder
ARG FLASHBOTS_BUILDER_REF="7845c515c32ef08f15c420fda0f5de4f2e6800cd"
ARG MAINIFOLD_FREELAY_REF="support-privatenet"
ENV GO_1_20_SHA256="5a9ebcc65c1cce56e0d2dc616aff4c4cedcfbda8cc6f0288cc08cda3b18dcbf1"
RUN install_packages curl ca-certificates git build-essential
# Install golang
RUN cd /tmp && curl -OL https://golang.org/dl/go1.20.linux-amd64.tar.gz
RUN echo "${GO_1_20_SHA256} /tmp/go1.20.linux-amd64.tar.gz" | sha256sum -c
RUN cd /tmp && tar -C /usr/local -xvf go1.20.linux-amd64.tar.gz
WORKDIR /usr/local/src
RUN git clone https://github.com/ChorusOne/mev-freelay.git relay/ && cd relay && git fetch origin "${MAINIFOLD_FREELAY_REF}" && git checkout "${MAINIFOLD_FREELAY_REF}"
WORKDIR /usr/local/src/relay
ENV PATH="/usr/local/go/bin/:$PATH"
RUN go mod download && mkdir bin/
RUN go build -o ./bin/mev-freelay ./cmd/freelay/main.go && go build -o ./bin/purge ./cmd/purge/main.go && go build -o ./bin/backup ./cmd/backup/main.go && go build -o ./bin/restore ./cmd/restore/main.go && go build -o ./bin/migrate ./cmd/migrate/main.go && go build -o ./bin/compact ./cmd/compact/main.go && go build -o ./bin/import ./cmd/import/main.go
RUN find .
WORKDIR /usr/local/src
RUN git clone https://github.com/flashbots/builder && cd builder && git fetch origin "${FLASHBOTS_BUILDER_REF}" && git checkout "${FLASHBOTS_BUILDER_REF}"
WORKDIR /usr/local/src/builder
RUN PATH="/usr/local/go/bin/:$PATH" go mod download
RUN PATH="/usr/local/go/bin/:$PATH" go run build/ci.go install -static ./cmd/geth
# genesis & zcli tools
FROM bitnami/minideb:${DEBIAN_RELEASE} AS genesisbuilder
# Testnet baking accessories
ARG ZCLI_REF="refs/tags/v0.7.1"
ARG ETH2_TESTNET_GENESIS_REF="4b3498476f14b872b43080eee319adea45286daf"
ENV GO_1_21_SHA256="13b76a9b2a26823e53062fa841b07087d48ae2ef2936445dc34c4ae03293702c"
ENV ZCLI_REF="${ZCLI_REF}"
ENV ETH2_TESTNET_GENESIS_REF="${ETH2_TESTNET_GENESIS_REF}"
WORKDIR /usr/local/src/
RUN install_packages curl ca-certificates git build-essential
# Install golang
RUN cd /tmp && curl -OL https://golang.org/dl/go1.21.7.linux-amd64.tar.gz
RUN echo "${GO_1_21_SHA256} /tmp/go1.21.7.linux-amd64.tar.gz" | sha256sum -c
RUN cd /tmp && tar -C /usr/local -xvf go1.21.7.linux-amd64.tar.gz
# Build zcli
RUN git clone https://github.com/protolambda/zcli.git && cd zcli && git fetch origin "${ZCLI_REF}" && git checkout "${ZCLI_REF}"
RUN cd zcli && PATH="/usr/local/go/bin/:$PATH" go build
# Build genesis tool
RUN git clone https://github.com/protolambda/eth2-testnet-genesis.git && cd eth2-testnet-genesis && git fetch origin "${ETH2_TESTNET_GENESIS_REF}" && git checkout "${ETH2_TESTNET_GENESIS_REF}"
RUN cd eth2-testnet-genesis && PATH="/usr/local/go/bin/:$PATH" go build
# builder and relay
FROM bitnami/minideb:${DEBIAN_RELEASE} AS ethodbuilder
ARG ETHDO_REF="5895bbfbe6484505ddf666f0f4c0e25dde3cce9b"
ENV GO_1_20_SHA256="5a9ebcc65c1cce56e0d2dc616aff4c4cedcfbda8cc6f0288cc08cda3b18dcbf1"
RUN install_packages curl ca-certificates git build-essential
# Install golang
RUN cd /tmp && curl -OL https://golang.org/dl/go1.20.linux-amd64.tar.gz
RUN echo "${GO_1_20_SHA256} /tmp/go1.20.linux-amd64.tar.gz" | sha256sum -c
RUN cd /tmp && tar -C /usr/local -xvf go1.20.linux-amd64.tar.gz
WORKDIR /usr/local/src/
RUN git clone https://github.com/ChorusOne/ethdo.git && cd ethdo && git fetch origin "${ETHDO_REF}" && git checkout "${ETHDO_REF}"
RUN cd ethdo && PATH="/usr/local/go/bin/:$PATH" go mod download
RUN cd ethdo && PATH="/usr/local/go/bin/:$PATH" go build
# geth image
FROM ethereum/client-go:alltools-v${GETH_VERSION} as geth
# lighthouse image
FROM sigp/lighthouse:v${LIGHTHOUSE_VERSION}-amd64-dev as lighthouse
# lcli image
FROM sigp/lcli:v${LCLI_VERSION} as lcli
# teku image
FROM consensys/teku:${TEKU_VERSION}-jdk17 as teku
# mev-boost img
FROM flashbots/mev-boost:${MEV_BOOST_VERSION} as mevboost
# install fresh haproxy (debian stock version is buggy)
FROM haproxy:2.8-bookworm AS haproxy
# ============= MAIN IMAGE ================
FROM bitnami/minideb:${DEBIAN_RELEASE} AS builder
RUN install_packages \
python3 \
python3-pip \
python3-venv \
openjdk-17-jdk-headless \
unzip \
curl \
sudo \
iblua5.3-0 \
libopentracing-c-wrapper0 \
make \
net-tools \
dnsutils \
procps \
psmisc \
jq
# Install Tilt
RUN curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
COPY --from=prysmbuilder /usr/local/prysm/bin/beacon-chain /usr/local/bin/prysm-beacon-chain
# Copy genesis & zcli tools from builder
COPY --from=genesisbuilder /usr/local/src/eth2-testnet-genesis/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
COPY --from=genesisbuilder /usr/local/src/zcli/zcli /usr/local/bin/zcli
# Copy client executables into the container
COPY --from=geth /usr/local/bin/geth /usr/bin/geth
COPY --from=geth /usr/local/bin/bootnode /usr/bin/bootnode
COPY --from=lighthouse /usr/local/bin/lighthouse /usr/local/bin/lighthouse
COPY --from=lcli /usr/local/bin/lcli /usr/local/bin/lcli
COPY --from=teku /opt/teku /opt/teku
COPY --from=mevbuilder /usr/local/src/builder/build/bin/geth /usr/local/bin/geth-mev-builder
COPY --from=mevbuilder /usr/local/src/relay/bin/mev-freelay /usr/local/bin/mev-freelay
COPY --from=mevboost /app/mev-boost /usr/local/bin/mev-boost
COPY --from=ethodbuilder /usr/local/src/ethdo/ethdo /usr/local/bin/ethdo
# Copy haproxy
COPY --from=haproxy /usr/local/sbin/haproxy /usr/local/bin/haproxy
WORKDIR /opt/privatenet
RUN python3 -m venv venv
COPY requirements.txt /opt/privatenet/requirements.txt
RUN venv/bin/python3 -m pip install -r requirements.txt
COPY setup.py MANIFEST.in README.md LICENSE Tiltfile Makefile /opt/privatenet/
COPY eth_possim /opt/privatenet/eth_possim
RUN venv/bin/python3 setup.py install
ENV PATH="/opt/privatenet/venv/bin:$PATH"
ENV PYTHONPATH="/opt/privatenet/:${PYTHONPATH}"
ENTRYPOINT [ "make" ]