From 237c13d4229f9b431474d49c58b4544fb5ad3903 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 22 Feb 2024 16:46:52 +0100 Subject: [PATCH] docker: started work on a dockerfile --- Dockerfile | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 8 +++ 2 files changed, 198 insertions(+) create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ef2bff5 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..b1ce405 --- /dev/null +++ b/entrypoint.sh @@ -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" \ No newline at end of file