Skip to content

Commit

Permalink
choir: more dockerfiles from noir
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasRidhuan committed Mar 7, 2024
1 parent 9a4b42f commit 28603a5
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 37 deletions.
4 changes: 2 additions & 2 deletions barretenberg/acir_tests/Dockerfile.bb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM aztecprotocol/barretenberg-x86_64-linux-clang-assert
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0-alpine
RUN apk update && apk add git bash curl jq coreutils
FROM node:18.19.0
RUN apt update && apt install git bash curl jq coreutils -y
COPY --from=0 /usr/src/barretenberg/cpp/build /usr/src/barretenberg/cpp/build
COPY --from=noir-acir-tests /usr/src/noir/noir-repo/test_programs /usr/src/noir/noir-repo/test_programs
WORKDIR /usr/src/barretenberg/acir_tests
Expand Down
15 changes: 11 additions & 4 deletions barretenberg/acir_tests/Dockerfile.bb.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ FROM aztecprotocol/barretenberg-x86_64-linux-clang-assert
FROM aztecprotocol/barretenberg-x86_64-linux-clang-sol
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0-alpine
RUN apk update && apk add git bash curl jq
FROM node:18.19.0
RUN apt update && apt install git bash curl jq -y
COPY --from=0 /usr/src/barretenberg/cpp/build /usr/src/barretenberg/cpp/build
COPY --from=1 /usr/src/barretenberg/sol/src/ultra/BaseUltraVerifier.sol /usr/src/barretenberg/sol/src/ultra/BaseUltraVerifier.sol
COPY --from=noir-acir-tests /usr/src/noir/noir-repo/test_programs /usr/src/noir/noir-repo/test_programs
COPY --from=ghcr.io/foundry-rs/foundry:latest /usr/local/bin/anvil /usr/local/bin/anvil
# COPY --from=ghcr.io/foundry-rs/foundry:latest /usr/local/bin/anvil /usr/local/bin/anvil

RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="${PATH}:/root/.foundry/bin"
RUN foundryup

WORKDIR /usr/src/barretenberg/acir_tests
COPY . .
# Run every acir test through a solidity verifier.
RUN (cd sol-test && yarn)
RUN PARALLEL=1 FLOW=sol ./run_acir_tests.sh
CMD ["/bin/bash"]
# RUN PARALLEL=1 FLOW=sol ./run_acir_tests.sh

Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ COPY . .
RUN ./format.sh check && cmake --preset clang16 -DCMAKE_BUILD_TYPE=RelWithAssert -DCI=ON && cmake --build --preset clang16
RUN srs_db/download_grumpkin.sh

CMD ["/bin/bash"]

# FROM ubuntu:lunar
# RUN apt update && apt install curl libstdc++6 -y
# COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
# COPY --from=builder /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin
FROM ubuntu:lunar
RUN apt update && apt install curl libstdc++6 -y
COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
COPY --from=builder /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin
55 changes: 36 additions & 19 deletions barretenberg/sol/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,53 @@
FROM alpine:3.18
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
build-base \
clang16 \
openmp-dev \
cmake \
ninja \
git \
curl \
perl
FROM ubuntu:lunar as builder

RUN apt update && apt install -y \
build-essential \
curl \
git \
cmake \
lsb-release \
wget \
software-properties-common \
gnupg \
ninja-build \
npm \
libssl-dev \
jq \
bash \
libstdc++6

RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 16

WORKDIR /usr/src/barretenberg/cpp

COPY ./cpp .
# Build everything to ensure everything builds. All tests will be run from the result of this build.
RUN cmake --preset clang16 && cmake --build --preset clang16 --target solidity_key_gen solidity_proof_gen

FROM docker.io/frolvlad/alpine-glibc:alpine-3.17_glibc-2.34 as builder
RUN apk update && apk add git curl build-base openmp-dev bash

COPY --from=0 /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin
COPY --from=0 /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
# FROM docker.io/frolvlad/alpine-glibc:alpine-3.17_glibc-2.34 as builder
# RUN apk update && apk add git curl build-base openmp-dev bash
FROM ubuntu:lunar
RUN apt update && apt install -y \
build-essential \
curl \
git \
bash \
libomp-dev

COPY --from=builder /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin
COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
WORKDIR /usr/src/barretenberg/sol
COPY ./sol .

# Copy forge binary directly from foundry
COPY --from=ghcr.io/foundry-rs/foundry:latest /usr/local/bin/forge /usr/local/bin/forge
# COPY --from=ghcr.io/foundry-rs/foundry:latest /usr/local/bin/forge /usr/local/bin/forge
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="${PATH}:/root/.foundry/bin"
RUN foundryup

RUN cd ../cpp/srs_db && ./download_ignition.sh 3 && cd ../../sol

RUN ./scripts/init.sh

# TestBase is excluded as it is just boilerplate
RUN forge test --no-match-contract TestBase
RUN forge test --no-match-contract TestBase
4 changes: 2 additions & 2 deletions barretenberg/ts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM aztecprotocol/barretenberg-wasm-linux-clang

FROM node:18.19.0-alpine
FROM node:18.19.0
COPY --from=0 /usr/src/barretenberg /usr/src/barretenberg

# Create a standalone container that can run bb.js (and tests).
Expand All @@ -17,4 +17,4 @@ RUN yarn formatting && SKIP_CPP_BUILD=1 yarn build
CMD ["yarn", "test"]

# We want to create a pure package, as would be published to npm, for consuming projects.
RUN yarn pack && tar zxf package.tgz && rm package.tgz && mv package ../ts
RUN yarn pack && tar zxf package.tgz && rm package.tgz && mv package ../ts
13 changes: 10 additions & 3 deletions l1-contracts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Building requires foundry.
FROM ghcr.io/foundry-rs/foundry:nightly-4a643801d0b3855934cdec778e33e79c79971783
RUN apk update && apk add git jq bash nodejs npm yarn python3 py3-pip && pip3 install slither-analyzer==0.10.0 slitherin==0.5.0
# FROM ghcr.io/foundry-rs/foundry:nightly-4a643801d0b3855934cdec778e33e79c79971783
FROM ubuntu:lunar
RUN apt update && apt install git jq bash nodejs npm yarn python3 py3-pip -y && pip3 install slither-analyzer==0.10.0 slitherin==0.5.0

RUN curl -L https://foundry.paradigm.xyz | bash
RUN source ~/.bashrc
ENV PATH="~/.foundry/bin:${PATH}"
RUN foundryup

WORKDIR /usr/src/l1-contracts
COPY . .
RUN git init
Expand All @@ -10,4 +17,4 @@ RUN git add . && yarn slither && yarn slither-has-diff
RUN forge build

FROM scratch
COPY --from=0 /usr/src/l1-contracts/out /usr/src/l1-contracts/out
COPY --from=0 /usr/src/l1-contracts/out /usr/src/l1-contracts/out
2 changes: 1 addition & 1 deletion noir/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY . .
RUN ./scripts/bootstrap_native.sh

# When running the container, mount the users home directory to same location.
FROM ubuntu:focal
FROM ubuntu:lunar
# Install Tini as nargo doesn't handle signals properly.
# Install git as nargo needs it to clone.
RUN apt-get update && apt-get install -y git tini && rm -rf /var/lib/apt/lists/* && apt-get clean
Expand Down

0 comments on commit 28603a5

Please sign in to comment.