Skip to content

Commit

Permalink
separate Dockerfile for action and as base
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Mar 8, 2024
1 parent db8f093 commit f0b77da
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
file: ./Dockerfile.base
push: true
tags: ghcr.io/${{ github.repository_owner }}/eip3074-tools:latest
58 changes: 1 addition & 57 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,4 @@
FROM ubuntu:jammy-20240212 as solc-builder
FROM ghcr.io/fgimenez/eip3074-tools:latest

# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
git \
libboost-all-dev \
&& \
update-ca-certificates

ENV SOLC_COMMIT=c3af02c281f54932c0adcbdf32899d0d6e988850

# Clone the Solidity repository
RUN git clone https://github.com/ethereum/solidity.git /app/solidity

WORKDIR /app/solidity

RUN git checkout $SOLC_COMMIT

COPY ./patches/solc.diff .
RUN git apply solc.diff && \
mkdir build && \
cd build && \
ls -al /app/solidity && \
cmake .. -DCMAKE_BUILD_TYPE=Release && \
make solc

FROM rust:1.76.0-slim-buster as forge-builder

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git

ENV FORGE_COMMIT=5b7e4cb3c882b28f3c32ba580de27ce7381f415a

RUN git clone https://github.com/foundry-rs/foundry.git /app/foundry

WORKDIR /app/foundry

RUN git checkout $FORGE_COMMIT

COPY ./patches/forge.diff .

RUN git apply forge.diff && \
cargo build --bin forge --release

FROM ubuntu:jammy-20240212

# Copy the compiled solc binary to a standard location
COPY --from=solc-builder /app/solidity/build/solc/solc /usr/local/bin/solc
COPY --from=forge-builder /app/foundry/target/release/forge /usr/local/bin/forge

RUN chmod +x /usr/local/bin/solc && \
chmod +x /usr/local/bin/forge

# Set the entrypoint to the solc binary
ENTRYPOINT ["/usr/local/bin/forge"]
CMD ["--help"]
56 changes: 56 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM ubuntu:jammy-20240212 as solc-builder

# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
git \
libboost-all-dev \
&& \
update-ca-certificates

ENV SOLC_COMMIT=c3af02c281f54932c0adcbdf32899d0d6e988850

# Clone the Solidity repository
RUN git clone https://github.com/ethereum/solidity.git /app/solidity

WORKDIR /app/solidity

RUN git checkout $SOLC_COMMIT

COPY ./patches/solc.diff .
RUN git apply solc.diff && \
mkdir build && \
cd build && \
ls -al /app/solidity && \
cmake .. -DCMAKE_BUILD_TYPE=Release && \
make solc

FROM rust:1.76.0-slim-buster as forge-builder

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
git

ENV FORGE_COMMIT=5b7e4cb3c882b28f3c32ba580de27ce7381f415a

RUN git clone https://github.com/foundry-rs/foundry.git /app/foundry

WORKDIR /app/foundry

RUN git checkout $FORGE_COMMIT

COPY ./patches/forge.diff .

RUN git apply forge.diff && \
cargo build --bin forge --release

FROM ubuntu:jammy-20240212

# Copy the compiled solc binary to a standard location
COPY --from=solc-builder /app/solidity/build/solc/solc /usr/local/bin/solc
COPY --from=forge-builder /app/foundry/target/release/forge /usr/local/bin/forge

RUN chmod +x /usr/local/bin/solc && \
chmod +x /usr/local/bin/forge

0 comments on commit f0b77da

Please sign in to comment.