Skip to content

Commit

Permalink
fix: Use pushed build images. (#6154)
Browse files Browse the repository at this point in the history
Please read [contributing guidelines](CONTRIBUTING.md) and remove this
line.
  • Loading branch information
charlielye authored May 2, 2024
1 parent e295900 commit 426f7a7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 85 deletions.
3 changes: 2 additions & 1 deletion build-images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ RUN ulimit -n 65535 && \
mv ./target/local/$t /opt/foundry/bin/$t; \
strip /opt/foundry/bin/$t; \
done
FROM scratch AS foundry
FROM ubuntu:noble AS foundry
COPY --from=foundry-build /opt/foundry /opt/foundry
ENV PATH="/opt/foundry/bin:$PATH"

########################################################################################################################
# This image contains *just* what's needed to perform a full build of the aztec project.
Expand Down
78 changes: 1 addition & 77 deletions build-images/Earthfile
Original file line number Diff line number Diff line change
@@ -1,80 +1,4 @@
VERSION 0.8

# TODO(AD): This is a kludge. There seem to be caching issues with FROM DOCKERFILE
# This needs to be investigated with a better workaround, but, until then, this prevents CI from being unstable.
# See Dockerfile for comments.

wasi-sdk:
FROM aztecprotocol/wasi-sdk:22.0
SAVE ARTIFACT /opt/wasi-sdk

osxcross:
FROM aztecprotocol/osxcross:14.0
SAVE ARTIFACT /opt/osxcross

foundry:
FROM aztecprotocol/foundry:de33b6af53005037b463318d2628b5cfcaf39916
SAVE ARTIFACT /opt/foundry

build:
FROM ubuntu:noble
RUN apt update && \
apt install -y \
# Utils
curl \
git \
curl \
wget \
jq \
gawk \
unzip \
netcat-openbsd \
parallel \
# C++ (clang=18, which we will move to. 16 is for current build.)
build-essential \
cmake \
ninja-build \
clang \
clang-16 \
clang-format-16 \
libc++-dev \
libomp-dev \
doxygen \
# Node (18.19.1)
nodejs \
npm \
# Python (clang bindings for wasm bindgen.)
python3 \
python3-clang && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install wasi-sdk.
COPY +wasi-sdk/wasi-sdk /opt/wasi-sdk

# Install osxcross. Requires developer to mount SDK from their mac host.
COPY +osxcross/osxcross /opt/osxcross
ENV PATH="/opt/osxcross/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/osxcross/lib:$LD_LIBRARY_PATH"

# Install foundry.
COPY +foundry/foundry /opt/foundry
ENV PATH="/opt/foundry/bin:$PATH"

# Install rust and cross-compilers. Noir specifically uses 1.74.1.
# We add everyone write ownership so downstream boxes can write.
ENV RUSTUP_HOME=/opt/rust/rustup
ENV CARGO_HOME=/opt/rust/cargo
ENV PATH="/opt/rust/cargo/bin:$PATH"
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.74.1 && \
rustup target add wasm32-unknown-unknown wasm32-wasi aarch64-apple-darwin && \
chmod -R a+w /opt/rust

# Install yq
RUN curl -L https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_$(dpkg --print-architecture) \
-o /usr/local/bin/yq && chmod +x /usr/local/bin/yq

# Install yarn
RUN npm install --global yarn

# Install solhint
RUN npm install --global solhint
SAVE ARTIFACT /opt/foundry/bin/anvil
FROM aztecprotocol/build:1.0
28 changes: 25 additions & 3 deletions build-images/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARCH := $(shell uname -m | sed 's/aarch64/arm64/')
FOUNDRY_TAG := de33b6af53005037b463318d2628b5cfcaf39916
VERSION := 1.0

wasi-sdk:
docker build -t aztecprotocol/wasi-sdk:$(ARCH)-22.0 --target wasi-sdk --push .
Expand All @@ -7,26 +9,46 @@ wasi-sdk:
--amend aztecprotocol/wasi-sdk:arm64-22.0
docker manifest push aztecprotocol/wasi-sdk:22.0

FOUNDRY_TAG := de33b6af53005037b463318d2628b5cfcaf39916
foundry:
docker build -t aztecprotocol/foundry:$(ARCH)-$(FOUNDRY_TAG) --build-arg TAG=$(FOUNDRY_TAG) --target foundry --push .
docker tag aztecprotocol/foundry:$(ARCH)-$(FOUNDRY_TAG) aztecprotocol/foundry:$(FOUNDRY_TAG)
docker manifest rm aztecprotocol/foundry:$(FOUNDRY_TAG)
docker manifest create aztecprotocol/foundry:$(FOUNDRY_TAG) \
--amend aztecprotocol/foundry:x86_64-$(FOUNDRY_TAG) \
--amend aztecprotocol/foundry:arm64-$(FOUNDRY_TAG)
docker manifest push aztecprotocol/foundry:$(FOUNDRY_TAG)

osxcross:
docker build -t aztecprotocol/osxcross:$(ARCH)-14.0 --target osxcross --push .
docker manifest rm aztecprotocol/osxcross:14.0
docker manifest create aztecprotocol/osxcross:14.0 \
--amend aztecprotocol/osxcross:x86_64-14.0 \
--amend aztecprotocol/osxcross:arm64-14.0
docker manifest push aztecprotocol/osxcross:14.0

build:
docker build -t aztecprotocol/build --target build .
docker build -t aztecprotocol/build:$(ARCH)-$(VERSION) --target build .
docker tag aztecprotocol/build:$(ARCH)-$(VERSION) aztecprotocol/build

build-push: build
docker push aztecprotocol/build:$(ARCH)-$(VERSION)
docker manifest rm aztecprotocol/build:$(VERSION)
docker manifest create aztecprotocol/build:$(VERSION) \
--amend aztecprotocol/build:x86_64-$(VERSION) \
--amend aztecprotocol/build:arm64-$(VERSION)
docker manifest push aztecprotocol/build:$(VERSION)

devbox:
docker build -t aztecprotocol/devbox --target devbox .
docker build -t aztecprotocol/devbox:$(ARCH)-$(VERSION) --target devbox .
docker tag aztecprotocol/devbox:$(ARCH)-$(VERSION) aztecprotocol/devbox

devbox-push: devbox
docker push aztecprotocol/devbox:$(ARCH)-$(VERSION)
docker manifest rm aztecprotocol/devbox:$(VERSION)
docker manifest create aztecprotocol/devbox:$(VERSION) \
--amend aztecprotocol/devbox:x86_64-$(VERSION) \
--amend aztecprotocol/devbox:arm64-$(VERSION)
docker manifest push aztecprotocol/devbox:$(VERSION)

sysbox:
docker build -t aztecprotocol/sysbox --target sysbox .
Expand Down
6 changes: 5 additions & 1 deletion yarn-project/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ end-to-end-prod:
**/artifacts
SAVE ARTIFACT /usr/src /usr/src

anvil:
FROM ../build-images+build
SAVE ARTIFACT /opt/foundry/bin/anvil

end-to-end:
FROM ubuntu:noble
RUN apt-get update && apt-get install -y wget gnupg \
Expand All @@ -100,7 +104,7 @@ end-to-end:
&& rm -rf /var/lib/apt/lists/*
ENV CHROME_BIN="/usr/bin/google-chrome-stable"
ENV PATH=/opt/foundry/bin:$PATH
COPY ../build-images+build/anvil /opt/foundry/bin/anvil
COPY +anvil/anvil /opt/foundry/bin/anvil
COPY +end-to-end-prod/usr/src /usr/src
WORKDIR /usr/src/yarn-project/end-to-end
RUN ln -s /usr/src/yarn-project/.yarn/releases/yarn-3.6.3.cjs /usr/local/bin/yarn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3'
services:
fork:
image: aztecprotocol/foundry-nightly-de33b6af53005037b463318d2628b5cfcaf3991:latest
image: aztecprotocol/foundry:de33b6af53005037b463318d2628b5cfcaf39916
pull_policy: always
entrypoint: >
sh -c '
if [ -n "$FORK_BLOCK_NUMBER" ] && [ -n "$FORK_URL" ]; then
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/end-to-end/scripts/docker-compose-p2p.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3'
services:
fork:
image: aztecprotocol/foundry-nightly-de33b6af53005037b463318d2628b5cfcaf3991:latest
image: aztecprotocol/foundry:de33b6af53005037b463318d2628b5cfcaf39916
pull_policy: always
entrypoint: 'anvil --silent -p 8545 --host 0.0.0.0 --chain-id 31337'
expose:
- '8545'
Expand Down
3 changes: 2 additions & 1 deletion yarn-project/end-to-end/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3'
services:
fork:
image: aztecprotocol/foundry-nightly-de33b6af53005037b463318d2628b5cfcaf3991:latest
image: aztecprotocol/foundry:de33b6af53005037b463318d2628b5cfcaf39916
pull_policy: always
entrypoint: >
sh -c '
if [ -n "$FORK_BLOCK_NUMBER" ] && [ -n "$FORK_URL" ]; then
Expand Down

0 comments on commit 426f7a7

Please sign in to comment.