Skip to content

Commit 952072b

Browse files
authored
Merge pull request #1422 from crytic/docker-improvements
docker: update base image; build with musl; include z3, bitwuzla
2 parents d07b2b1 + a9df8f3 commit 952072b

File tree

2 files changed

+50
-20
lines changed

2 files changed

+50
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ You can get further information in the [`echidna` Homebrew Formula](https://form
203203
If you prefer to use a pre-built Docker container, check out our [docker
204204
package](https://github.com/orgs/crytic/packages?repo_name=echidna), which is
205205
auto-built via GitHub Actions. The `echidna` container is based on
206-
`ubuntu:focal` and it is meant to be a small yet flexible enough image to use
206+
`ubuntu:noble` and it is meant to be a small yet flexible enough image to use
207207
Echidna on. It provides a pre-built version of `echidna`, as well as
208208
`slither`, `crytic-compile`, `solc-select` and `nvm` under 200 MB.
209209

docker/Dockerfile

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,66 @@
1-
FROM ubuntu:focal AS builder-echidna
2-
ENV LD_LIBRARY_PATH=/usr/local/lib PREFIX=/usr/local HOST_OS=Linux
3-
RUN apt-get update && \
4-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-suggests --no-install-recommends \
1+
FROM docker.io/benz0li/ghc-musl:9.8.4 AS builder-echidna
2+
# https://gitlab.com/benz0li/ghc-musl
3+
4+
RUN apk upgrade --no-cache &&\
5+
apk add --no-cache \
6+
autoconf \
7+
automake \
8+
binutils-gold \
59
cmake \
6-
curl \
7-
git \
8-
libbz2-dev \
9-
libgmp-dev \
10-
libreadline-dev \
11-
libsecp256k1-dev \
12-
libssl-dev \
13-
software-properties-common \
14-
sudo
15-
RUN curl -sSL https://get.haskellstack.org/ | sh
10+
libtool
11+
12+
RUN mkdir -p /etc/stack &&\
13+
{ echo "system-ghc: true" ;\
14+
echo "install-ghc: false" ;\
15+
echo "skip-ghc-check: true" ;\
16+
} >> /etc/stack/config.yaml
17+
18+
ENV LD_LIBRARY_PATH=/usr/local/lib PREFIX=/usr/local HOST_OS=Linux
1619
COPY . /echidna/
1720
WORKDIR /echidna
21+
RUN .github/scripts/install-libsecp256k1.sh
1822
RUN .github/scripts/install-libff.sh
1923
RUN stack upgrade && stack setup && stack install --flag echidna:static --extra-include-dirs=/usr/local/include --extra-lib-dirs=/usr/local/lib
2024

2125

22-
FROM ubuntu:focal AS builder-python3
26+
FROM ubuntu:noble AS builder-python3
2327
RUN apt-get update && \
2428
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-suggests --no-install-recommends \
2529
gcc \
26-
python3.8-dev \
27-
python3.8-venv
30+
python3 \
31+
python3.12-dev \
32+
python3.12-venv
2833
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
2934
ENV PIP_NO_CACHE_DIR=1
3035
RUN python3 -m venv /venv && /venv/bin/pip3 install --no-cache --upgrade setuptools pip
3136
RUN /venv/bin/pip3 install --no-cache slither-analyzer solc-select
3237

3338

39+
FROM ubuntu:noble AS builder-solvers
40+
RUN apt-get update && \
41+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-suggests --no-install-recommends \
42+
unzip \
43+
ca-certificates \
44+
curl
45+
RUN mkdir /solvers/
46+
RUN if [ $(uname -m) = "aarch64" ]; then \
47+
curl -fsSL -o z3.zip https://github.com/Z3Prover/z3/releases/download/z3-4.15.2/z3-4.15.2-arm64-glibc-2.34.zip; \
48+
elif [ $(uname -m) = "x86_64" ]; then \
49+
curl -fsSL -o z3.zip https://github.com/Z3Prover/z3/releases/download/z3-4.15.2/z3-4.15.2-x64-glibc-2.39.zip; \
50+
fi && \
51+
unzip z3.zip && \
52+
cp -a z3-*/* /solvers/ && \
53+
rm -rf z3-*/ z3.zip
54+
RUN if [ $(uname -m) = "aarch64" ]; then \
55+
curl -fsSL -o bitwuzla.zip https://github.com/bitwuzla/bitwuzla/releases/download/0.8.2/Bitwuzla-Linux-arm64-static.zip; \
56+
elif [ $(uname -m) = "x86_64" ]; then \
57+
curl -fsSL -o bitwuzla.zip https://github.com/bitwuzla/bitwuzla/releases/download/0.8.2/Bitwuzla-Linux-x86_64-static.zip; \
58+
fi && \
59+
unzip bitwuzla.zip && \
60+
cp -a Bitwuzla-*/* /solvers/ && \
61+
rm -rf Bitwuzla-*/ bitwuzla.zip
62+
63+
3464
FROM gcr.io/distroless/python3-debian11:nonroot AS final-distroless
3565
COPY --from=builder-echidna /root/.local/bin/echidna /usr/local/bin/echidna
3666
COPY --from=builder-python3 /venv /venv
@@ -39,16 +69,16 @@ ENV PATH="$PATH:/venv/bin"
3969
ENTRYPOINT [ "/usr/local/bin/solc-install", "/usr/local/bin/echidna" ]
4070

4171

42-
FROM ubuntu:focal AS final-ubuntu
72+
FROM ubuntu:noble AS final-ubuntu
4373
RUN apt-get update && \
4474
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-suggests --no-install-recommends \
4575
ca-certificates \
4676
curl \
4777
python3 \
48-
python3-distutils \
4978
&& \
5079
rm -rf /var/lib/apt/lists/*
5180
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
81+
COPY --from=builder-solvers /solvers/bin/z3 /solvers/bin/bitwuzla /usr/local/bin/
5282
COPY --from=builder-echidna /root/.local/bin/echidna /usr/local/bin/echidna
5383
RUN ln -s /usr/local/bin/echidna /usr/local/bin/echidna-test
5484
COPY --from=builder-python3 /venv /venv

0 commit comments

Comments
 (0)