Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: started work on a dockerfile #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#
# The Mega Dockerfile
# created by @holiman
# adapted from https://github.com/holiman/goevmlab/blob/master/docker/Dockerfile
#
# This dockerfile is an attempt to bundle the following components into
# one big dockerfile:
#
# - [x] FuzzyVM
# [x] Goevmlab binary 'runtest'
# - [x] Go-ethereum binary 'evm'
# - [x] Erigon binary 'evm'
# - [x] EvmOne vm binary 'evmone'
# - [x] Reth VM binary 'revme'
# - [x] Besu
# - [x] Nethermind
# - [x] Nimbus-eth1
#

#---------------------------------------------------------------
# golang-builder (debian-based)
#---------------------------------------------------------------
FROM golang:latest as golang-builder

#
# FuzzyVM
#
RUN git clone https://github.com/MariusVanDerWijden/FuzzyVM --depth 1
RUN cd FuzzyVM && \
go build .

#
# Go-evmlab
#

RUN git clone https://github.com/holiman/goevmlab --depth 1
RUN cd goevmlab && \
go build ./cmd/generic-fuzzer && \
go build ./cmd/checkslow && \
go build ./cmd/minimizer && \
go build ./cmd/repro && \
go build ./cmd/runtest && \
go build ./cmd/tracediff && \
go build ./cmd/traceview

#
# GETH
#

RUN git clone https://github.com/ethereum/go-ethereum --depth 1
RUN cd go-ethereum && go run build/ci.go install -static ./cmd/evm

#
# Erigon
#
RUN git clone https://github.com/ledgerwatch/erigon --depth 1
RUN cd erigon && make evm && cp ./build/bin/evm /erigon_vm

#
# NIMBUS-ETH1
#

RUN git clone https://github.com/status-im/nimbus-eth1.git --depth 1 --recurse-submodules
RUN apt-get update -q && apt-get install -qy --no-install-recommends make
RUN cd nimbus-eth1 && make -j8 update
RUN cd nimbus-eth1 && make -j8 evmstate
RUN cp nimbus-eth1/tools/evmstate/evmstate /evmstate

RUN echo "please" >> /build.sequential

RUN ls -la /go/goevmlab/tracediff

#---------------------------------------------------------------
# debian-builder
#---------------------------------------------------------------

#
# EVMONE
#
#
# evmone requires g++ v13, which is _not_ available in debian bookworm (the golang image)
# but it works with debian:testing (at the time of writing this)

FROM debian:testing as debian-builder
RUN apt-get update -q && apt-get install -qy --no-install-recommends git make \
ca-certificates g++ cmake ninja-build libgmp-dev
COPY --from=golang-builder /build.sequential /build.sequential

RUN git clone https://github.com/ethereum/evmone.git --depth 1 --recurse-submodules
RUN cd evmone && cmake -S . -B build -DEVMONE_TESTING=ON -DEVMONE_PRECOMPILES_SILKPRE=1
RUN cd evmone && cmake --build build --parallel
RUN cp /evmone/build/bin/evmone-statetest /evmone-statetest
RUN cp /evmone/build/lib/libevmone.so.0.12 /libevmone.so.0.12
#---------------------------------------------------------------
# rust-builder
#---------------------------------------------------------------

#
# RETH
#

FROM lukemathwalker/cargo-chef:latest-rust-1 AS rust-builder
RUN apt-get update -q && apt-get install -qy --no-install-recommends libclang-dev pkg-config
COPY --from=debian-builder /build.sequential /build.sequential
RUN git clone https://github.com/bluealloy/revm.git --depth 1
RUN cd revm && cargo build --release --package revme


#---------------------------------------------------------------
# dotnet-builder
#---------------------------------------------------------------


#
# NETHERMIND
#

FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS dotnet-builder
RUN git clone https://github.com/NethermindEth/nethermind --depth 1 --recurse-submodules
COPY --from=rust-builder /build.sequential /build.sequential

RUN cd nethermind/src/Nethermind/Nethermind.Test.Runner && dotnet publish --self-contained true -r linux-x64 -c Release
RUN mkdir /out && mv nethermind/src/Nethermind/artifacts/bin/Nethermind.Test.Runner/release_linux-x64 /out/neth

#---------------------------------------------------------------
# java-builder
#---------------------------------------------------------------

#
# BESU
#

FROM ubuntu:23.10 as java-builder

RUN apt-get update -q && apt-get install -qy --no-install-recommends git ca-certificates
RUN git clone https://github.com/hyperledger/besu.git --depth 1 #--recurse-submodules
RUN apt-get install -qy --no-install-recommends git openjdk-17-jre-headless=17* libjemalloc-dev=5.*
COPY --from=dotnet-builder /build.sequential /build.sequential
RUN cd besu && ./gradlew --parallel ethereum:evmtool:installDist
RUN mkdir /out && mv besu/ethereum/evmtool/build/install/evmtool /out/evmtool

#
# Main non-builder
#

FROM debian:testing

RUN apt-get update -q
# nethtest requires libssl-dev
RUN apt-get install -qy --no-install-recommends libssl-dev
# besu requires openjdk-17-jre
RUN apt-get install -qy --no-install-recommends openjdk-17-jre
# FuzzyVM requires golang
COPY --from=golang:latest /usr/local/go/ /usr/local/go/

ENV PATH="/usr/local/go/bin:${PATH}"

# FuzzyVM target
COPY --from=golang-builder /go/FuzzyVM/FuzzyVM /

# Go-evmlab targets
COPY --from=golang-builder /go/goevmlab/generic-fuzzer /
COPY --from=golang-builder /go/goevmlab/checkslow /
COPY --from=golang-builder /go/goevmlab/minimizer /
COPY --from=golang-builder /go/goevmlab/repro /
COPY --from=golang-builder /go/goevmlab/runtest /
COPY --from=golang-builder /go/goevmlab/tracediff /
COPY --from=golang-builder /go/goevmlab/traceview /

COPY --from=golang-builder /go/go-ethereum/build/bin/evm /gethvm
COPY --from=golang-builder /erigon_vm /erigon_vm
COPY --from=golang-builder /evmstate /nimbvm

COPY --from=debian-builder /evmone-statetest /evmone
COPY --from=debian-builder /libevmone.so.0.12 /lib/libevmone.so.0.12

COPY --from=rust-builder /revm/target/release/revme /revme

COPY --from=dotnet-builder /out/neth /neth
RUN ln -s /neth/nethtest /nethtest

COPY --from=java-builder /out/evmtool /evmtool
RUN ln -s /evmtool/bin/evm besu-vm

COPY --from=golang-builder /go/FuzzyVM /

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!bin/bash

echo "Starting FuzzyVM"
./FuzzyVM run &
echo "Sleep for a bit"
sleep 100
echo "Starting goevmlab"
./runtest --gethbatch=/gethvm --nethbatch=/nethtest --nimbus=/nimbvm --revme=/revme", "--erigonbatch=/erigon_vm --besubatch=/besu-vm --evmone=/evmone "out/*/*.json"