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

chore: move alpine containers to ubuntu #5026

Merged
merged 5 commits into from
Mar 10, 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
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
10 changes: 7 additions & 3 deletions barretenberg/acir_tests/Dockerfile.bb.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ 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

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

WORKDIR /usr/src/barretenberg/acir_tests
COPY . .
# Run the relevant acir tests through a solidity verifier.
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/dockerfiles/Dockerfile.bench
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM aztecprotocol/barretenberg-x86_64-linux-clang
WORKDIR /usr/src/barretenberg/cpp
RUN apk update && apk add curl libstdc++ jq
RUN apt update && apt install curl libstdc++6 jq -y
RUN ./scripts/ci/ultra_honk_bench.sh
37 changes: 23 additions & 14 deletions barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-clang
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
FROM alpine:3.18 AS builder
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
build-base \
clang16 \
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 . .
# Build bb binary and targets needed for benchmarking.
# Everything else is built as part linux-clang-assert.
# Benchmark targets want to run without asserts, so get built alongside bb.
RUN cmake --preset default
RUN cmake --build --preset default --target ultra_honk_rounds_bench --target bb --target grumpkin_srs_gen
RUN cmake --preset clang16
RUN cmake --build --preset clang16 --target ultra_honk_rounds_bench --target bb --target grumpkin_srs_gen

FROM alpine:3.18
FROM ubuntu:lunar
WORKDIR /usr/src/barretenberg/cpp
COPY . .
COPY --from=builder /usr/src/barretenberg/cpp/scripts/ci /usr/src/barretenberg/cpp/scripts/ci
Expand Down
43 changes: 25 additions & 18 deletions barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-assert
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# We have to stay on 3.17 for now, to get clang-format 15, as code is not yet formatted to 16.
FROM alpine:3.17 AS builder
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
build-base \
clang15 \
cmake \
ninja \
git \
curl \
perl \
clang-extra-tools \
bash
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 \
clang-format

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

WORKDIR /usr/src/barretenberg/cpp
COPY . .
# Build everything to ensure everything builds. All tests will be run from the result of this build.
RUN ./format.sh check && cmake --preset default -DCMAKE_BUILD_TYPE=RelWithAssert -DCI=ON && cmake --build --preset default
RUN ./format.sh check && cmake --preset clang16 -DCMAKE_BUILD_TYPE=RelWithAssert -DCI=ON && cmake --build --preset clang16
RUN srs_db/download_grumpkin.sh

FROM alpine:3.17
RUN apk update && apk add curl libstdc++
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
COPY --from=builder /usr/src/barretenberg/cpp/build/bin /usr/src/barretenberg/cpp/build/bin
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
FROM alpine:3.18 AS builder
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
build-base \
clang16 \
openmp-dev \
cmake \
ninja \
git \
curl \
perl
FROM ubuntu:lunar as builder

WORKDIR /usr/src/barretenberg/cpp
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 . .
# Build everything to ensure everything builds. All tests will be run from the result of this build.
RUN cmake --preset default && cmake --build --preset default --target external_bench
RUN cmake --preset clang16 && cmake --build --preset clang16 --target external_bench

FROM alpine:3.18
RUN apk update && apk add curl openmp
FROM ubuntu:lunar
RUN apt update && apt install curl libomp-dev -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/*_bench /usr/src/barretenberg/cpp/build/bin/
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/*_bench /usr/src/barretenberg/cpp/build/bin/
39 changes: 22 additions & 17 deletions barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-clang-fuzzing
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
FROM alpine:3.18 AS builder
RUN apk update && \
apk upgrade && \
apk add --no-cache \
build-base \
clang16 \
compiler-rt \
openmp-dev \
cmake \
ninja \
git \
curl \
perl
FROM ubuntu:lunar as builder

WORKDIR /usr/src/barretenberg/cpp
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 . .
# Build the entire project, as we want to check everything builds under clang
# Build the entire project, as we want to check everything builds under clang-fuzzing with clang-16.
RUN cmake --preset fuzzing && cmake --build --preset fuzzing

FROM alpine:3.18
RUN apk update && apk add openmp
FROM ubuntu:lunar
RUN apt update && apt install libomp-dev -y
COPY --from=builder /usr/src/barretenberg/cpp/srs_db /usr/src/barretenberg/cpp/srs_db
33 changes: 22 additions & 11 deletions barretenberg/cpp/dockerfiles/Dockerfile.x86_64-linux-gcc
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
FROM alpine:3.18 AS builder
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
build-base \
cmake \
ninja \
git \
curl
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 . .
# Build the entire project, as we want to check everything builds under gcc.
RUN cmake --preset gcc -DCI=ON && cmake --build --preset gcc

FROM alpine:3.18
RUN apk update && apk add libstdc++
FROM ubuntu:lunar
RUN apt update && apt install libstdc++6 -y
COPY --from=builder /usr/src/barretenberg/cpp/build-gcc/bin/bb /usr/src/barretenberg/cpp/build/bin/bb
52 changes: 33 additions & 19 deletions barretenberg/sol/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
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
FROM ubuntu:lunar
RUN apt update && apt install -y \
build-essential \
curl \
git \
bash \
libomp-dev

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
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
# Download and install foundry
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
20 changes: 17 additions & 3 deletions l1-contracts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# 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 ubuntu:lunar

RUN apt update && apt install curl git jq bash nodejs npm python3.11-full python3-pip -y

# Use virtualenv, do not try to use pipx, it's not working.
RUN python3 -m venv /root/.venv
RUN /root/.venv/bin/pip3 install slither-analyzer==0.10.0 slitherin==0.5.0
RUN curl -L https://foundry.paradigm.xyz | bash

# Set env variables for foundry and venv
ENV PATH="${PATH}:/root/.foundry/bin:/root/.venv/bin"
RUN foundryup

WORKDIR /usr/src/l1-contracts
COPY . .
RUN git init
RUN forge clean && forge fmt --check && forge build && forge test

RUN npm install --global yarn
RUN yarn && yarn lint

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
Loading