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

Reduce image size #3

Merged
merged 1 commit into from
Jun 4, 2024
Merged
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
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
Loading