forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dcbe3e
commit 12f65bf
Showing
1 changed file
with
1 addition
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,93 +28,6 @@ ENV PATH="/root/.local/bin:${PATH}" | |
# Install dependencies | ||
# We do this in one mega RUN command to avoid blowing up the size of the image | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && \ | ||
apt-get install -y build-essential git clang lld curl jq | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && \ | ||
chmod +x ./rustup.sh && \ | ||
sh rustup.sh -y | ||
|
||
# Install nightly toolchain | ||
RUN source $HOME/.profile && rustup update nightly | ||
|
||
RUN source $HOME/.profile && cargo install just | ||
RUN source $HOME/.profile && cargo install svm-rs --version 0.5.7 | ||
|
||
# Only diff from upstream docker image is this clone instead | ||
# of COPY. We select a specific commit to use. | ||
COPY ./versions.json ./versions.json | ||
COPY ./ops/scripts/install-foundry.sh ./install-foundry.sh | ||
|
||
RUN curl -L https://foundry.paradigm.xyz | bash | ||
RUN source $HOME/.profile && ./install-foundry.sh | ||
|
||
RUN strip /root/.foundry/bin/forge && \ | ||
strip /root/.foundry/bin/cast && \ | ||
strip /root/.foundry/bin/anvil && \ | ||
strip /root/.cargo/bin/svm && \ | ||
strip /root/.cargo/bin/just | ||
|
||
FROM --platform=linux/amd64 debian:bullseye-slim as go-build | ||
|
||
RUN apt-get update && apt-get install -y curl ca-certificates jq binutils | ||
|
||
ENV GO_VERSION=1.22.7 | ||
|
||
# Fetch go manually, rather than using a Go base image, so we can copy the installation into the final stage | ||
RUN curl -sL https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz -o go$GO_VERSION.linux-amd64.tar.gz && \ | ||
tar -C /usr/local/ -xzvf go$GO_VERSION.linux-amd64.tar.gz | ||
|
||
ENV GOPATH=/go | ||
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH | ||
|
||
# Install the specific version of abigen and geth from version control | ||
COPY ./versions.json ./versions.json | ||
RUN go install github.com/ethereum/go-ethereum/cmd/abigen@$(jq -r .abigen < versions.json) | ||
RUN go install github.com/ethereum/go-ethereum/cmd/geth@$(jq -r .geth < versions.json) | ||
|
||
RUN go install gotest.tools/[email protected] | ||
RUN go install golang.org/x/tools/cmd/goimports@latest | ||
RUN go install github.com/vektra/mockery/[email protected] | ||
RUN go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
RUN go install github.com/mikefarah/yq/[email protected] | ||
|
||
# Strip binaries to reduce size | ||
RUN strip /go/bin/gotestsum && \ | ||
strip /go/bin/mockery && \ | ||
strip /go/bin/golangci-lint && \ | ||
strip /go/bin/abigen && \ | ||
strip /go/bin/geth && \ | ||
strip /go/bin/yq | ||
|
||
FROM --platform=linux/amd64 debian:bullseye-slim as base-builder | ||
|
||
ENV GOPATH=/go | ||
ENV PATH=/usr/local/go/bin:$GOPATH/bin:$PATH | ||
ENV PATH=/root/.cargo/bin:$PATH | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# copy the go installation, but not the module cache (cache will get stale, and would add a lot of weight) | ||
COPY --from=go-build /usr/local/go /usr/local/go | ||
|
||
# copy tools | ||
COPY --from=go-build /go/bin/gotestsum /go/bin/gotestsum | ||
COPY --from=go-build /go/bin/mockery /go/bin/mockery | ||
COPY --from=go-build /go/bin/golangci-lint /go/bin/golangci-lint | ||
COPY --from=go-build /go/bin/goimports /go/bin/goimports | ||
COPY --from=go-build /go/bin/abigen /usr/local/bin/abigen | ||
COPY --from=go-build /go/bin/geth /usr/local/bin/geth | ||
COPY --from=go-build /go/bin/yq /go/bin/yq | ||
|
||
# copy tools | ||
COPY --from=rust-build /root/.foundry/bin/forge /usr/local/bin/forge | ||
COPY --from=rust-build /root/.foundry/bin/cast /usr/local/bin/cast | ||
COPY --from=rust-build /root/.foundry/bin/anvil /usr/local/bin/anvil | ||
COPY --from=rust-build /root/.cargo/bin/svm /usr/local/bin/svm | ||
COPY --from=rust-build /root/.cargo/bin/just /usr/local/bin/just | ||
|
||
COPY ./versions.json ./versions.json | ||
|
||
RUN /bin/sh -c set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends bash curl openssh-client git build-essential ca-certificates gnupg binutils-mips-linux-gnu clang libffi-dev; \ | ||
|
@@ -163,26 +76,14 @@ COPY --from=buildx /usr/libexec/docker/cli-plugins/docker-buildx /usr/libexec/do | |
# Set up entrypoint | ||
ENTRYPOINT ["/bin/bash", "-c"] | ||
|
||
|
||
############################################################################### | ||
# CI BUILDER (RUST) # | ||
############################################################################### | ||
|
||
FROM base-builder as rust-builder | ||
|
||
# Install clang & lld | ||
RUN apt-get update && apt-get install -y clang lld | ||
RUN apt-get update && apt-get install -y clang lld parallel | ||
|
||
# Install nightly toolchain | ||
RUN rustup update nightly | ||
|
||
# Install parallel | ||
RUN apt-get install -y parallel | ||
|
||
# Copy the rust installation, alongside the installed toolchains | ||
COPY --from=rust-build /root/.cargo /root/.cargo | ||
COPY --from=rust-build /root/.rustup /root/.rustup | ||
|
||
# copy the rust installation, alongside the installed toolchains | ||
COPY --from=rust-build /root/.cargo/bin /root/.cargo/bin | ||
COPY --from=rust-build /root/.rustup /root/.rustup |