Skip to content

Commit

Permalink
Merge pull request #3 from ethpandaops/reduce-dockerimage-size
Browse files Browse the repository at this point in the history
Reduce image size
  • Loading branch information
barnabasbusa authored Jun 4, 2024
2 parents a2f5570 + ef0841f commit be6846c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
63 changes: 35 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Use the Debian base image for broader compatibility
FROM debian:latest
FROM debian:latest as builder

WORKDIR /workspace

# Install dependencies using apt
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -20,48 +21,54 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libusb-1.0-0-dev \
libssl-dev \
ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install pnpm
RUN npm install -g pnpm@9

# Install Go from the official golang image
COPY --from=golang:alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"

# Install pnpm
RUN npm install -g pnpm@9

# Install web3 cli
RUN curl -LSs https://raw.githubusercontent.com/gochain/web3/master/install.sh | sh

# Install Rust and Foundry
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
cargo install --git https://github.com/foundry-rs/foundry --profile local --locked forge cast chisel anvil

# Ensure Foundry binaries are in PATH
ENV PATH="/root/.cargo/bin:${PATH}"
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"
RUN foundryup

# Clone the Optimism repository and set up the environment
WORKDIR /workspace
RUN git clone https://github.com/ethereum-optimism/optimism.git && \
cd optimism && \
git checkout tutorials/chain && \
pnpm install && \
#make op-node op-batcher op-proposer && \
pnpm build

# Verify installed versions
RUN git --version && \
go version && \
node --version && \
pnpm --version && \
forge --version && \
cast --version && \
make --version && \
jq --version && \
direnv --version

# Set the working directory
WORKDIR /workspace/optimism
# Use multi-stage build to keep the final image lean
FROM debian:stable-slim

WORKDIR /workspace

# Default command
# Install dependencies using apt
RUN apt-get update && apt-get install -y --no-install-recommends \
jq \
direnv \
bash \
curl \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/local /usr/local
COPY --from=builder /workspace/optimism /workspace/optimism
COPY --from=builder /root/.foundry /root/.foundry

# Set up environment variables
ENV PATH="/root/.foundry/bin:/usr/local/go/bin:${PATH}"


# Set the working directory and default command
WORKDIR /workspace/optimism
CMD ["bash"]
2 changes: 1 addition & 1 deletion src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MAX_CPU = 2000
MIN_MEMORY = 128
MAX_MEMORY = 1024

IMAGE = "bbusa/op:latest"
IMAGE = "parithoshj/op-test:v3"

ENVRC_PATH = "/workspace/optimism/.envrc"

Expand Down

0 comments on commit be6846c

Please sign in to comment.