diff --git a/.circleci/config.yml b/.circleci/config.yml index eb276b39bdf..435d9f88a99 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1389,16 +1389,15 @@ workflows: # Yarn Project - yarn-project-base: requires: - - avm-transpiler - - l1-contracts - bb-js - noir-packages - - noir-projects - - boxes-files <<: *defaults - yarn-project: requires: - yarn-project-base + - l1-contracts + - noir-projects + - boxes-files <<: *defaults - yarn-project-prod: *defaults_yarn_project - yarn-project-formatting: *defaults_yarn_project diff --git a/boxes/.dockerignore b/boxes/.dockerignore index bde85ad2dcd..7eab5f5a5cb 100644 --- a/boxes/.dockerignore +++ b/boxes/.dockerignore @@ -5,4 +5,5 @@ node_modules .tsbuildinfo Dockerfile* .dockerignore -docker-compose.yml \ No newline at end of file +docker-compose.yml +**/artifacts \ No newline at end of file diff --git a/boxes/Dockerfile b/boxes/Dockerfile index 9241170b544..ef381f2fff5 100644 --- a/boxes/Dockerfile +++ b/boxes/Dockerfile @@ -6,6 +6,7 @@ FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects # We need yarn. Start fresh container. FROM node:18.19.0 +RUN apt update && apt install netcat-openbsd COPY --from=aztec /usr/src /usr/src COPY --from=noir /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo COPY --from=noir-projects /usr/src/noir-projects/aztec-nr /usr/src/noir-projects/aztec-nr @@ -13,4 +14,4 @@ WORKDIR /usr/src/boxes ENV AZTEC_NARGO=/usr/src/noir/target/release/nargo ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest RUN yarn && yarn build -ENTRYPOINT ["yarn", "workspace"] +ENTRYPOINT ["/bin/sh", "-c"] diff --git a/boxes/docker-compose.yml b/boxes/docker-compose.yml index 957c8ee6852..18ab65d443f 100644 --- a/boxes/docker-compose.yml +++ b/boxes/docker-compose.yml @@ -18,7 +18,11 @@ services: boxes: image: aztecprotocol/boxes - command: "@aztec/$BOX test" + entrypoint: > + sh -c ' + while ! nc -z aztec 8080; do sleep 1; done; + yarn workspace @aztec/$BOX test + ' environment: DEBUG: "aztec:*" DEBUG_COLORS: "true" diff --git a/boxes/react/package.json b/boxes/react/package.json index 1d859052a83..9a5969152b6 100644 --- a/boxes/react/package.json +++ b/boxes/react/package.json @@ -14,7 +14,7 @@ "serve": "serve -p 3000 ./dist", "formatting": "prettier --check ./src && eslint ./src", "formatting:fix": "prettier -w ./src", - "test": "yarn prep && NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand" + "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand" }, "jest": { "preset": "ts-jest/presets/default-esm", diff --git a/build_manifest.yml b/build_manifest.yml index 665e16f6b24..7f29658c01e 100644 --- a/build_manifest.yml +++ b/build_manifest.yml @@ -135,13 +135,8 @@ yarn-project-base: - ^yarn-project/yarn.lock - ^yarn-project/.*/package.json$ dependencies: - - l1-contracts - bb.js - - noir - noir-packages - - boxes-files - - avm-transpiler - - noir-projects yarn-project: buildDir: yarn-project @@ -151,6 +146,9 @@ yarn-project: - ^yarn-project/cli/aztec-cli dependencies: - yarn-project-base + - l1-contracts + - boxes-files + - noir-projects yarn-project-prod: buildDir: yarn-project diff --git a/yarn-project/Dockerfile b/yarn-project/Dockerfile index 9de7d8776b8..aea67d0c588 100644 --- a/yarn-project/Dockerfile +++ b/yarn-project/Dockerfile @@ -4,19 +4,24 @@ # - Run the tests. # - Run the formatter checks. # Any subsequent build steps needed to support downstream containers should be done in those containers build files. -FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base as builder +FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/l1-contracts as contracts +FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects +FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/boxes-files as boxes-files -# Copy in the entire workspace. +FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base +COPY --from=contracts /usr/src/l1-contracts /usr/src/l1-contracts +COPY --from=noir-projects /usr/src/noir-projects /usr/src/noir-projects +COPY --from=boxes-files /usr/src/boxes /usr/src/boxes COPY . . - +# Generate L1 contract TypeScript artifacts. +RUN cd l1-artifacts && ./scripts/generate-artifacts.sh && rm -rf /usr/src/l1-contracts # This is actually our code generation tool. Needed to build contract typescript wrappers. RUN yarn workspace @aztec/noir-compiler build -# Builds noir contracts (TODO: move this stage pre yarn-project). Generates typescript wrappers. +# Generates typescript wrappers. RUN yarn workspace @aztec/noir-contracts.js build:contracts # We need to build accounts as it needs to copy in account contracts from noir-contracts. RUN yarn workspace @aztec/accounts build:copy-contracts RUN yarn workspace @aztec/protocol-contracts build:copy-contracts RUN yarn workspace @aztec/noir-protocol-circuits-types build RUN yarn tsc -b - ENTRYPOINT ["yarn"] diff --git a/yarn-project/yarn-project-base/Dockerfile b/yarn-project/yarn-project-base/Dockerfile index 933ec230be2..b53ed652bc0 100644 --- a/yarn-project/yarn-project-base/Dockerfile +++ b/yarn-project/yarn-project-base/Dockerfile @@ -42,25 +42,15 @@ # RUN yarn workspaces focus --production && yarn cache clean && rm -rf ../**/src # - Create final slim image by copying needed dirs into a fresh image. # -FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/l1-contracts as contracts FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/bb.js as bb.js -FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-projects as noir-projects FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-packages as noir-packages -FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/boxes-files as boxes-files FROM node:18.19.0 RUN apt update && apt install -y jq curl perl && rm -rf /var/lib/apt/lists/* && apt-get clean -# Copy L1 contracts. -COPY --from=contracts /usr/src/l1-contracts /usr/src/l1-contracts -# Copy in bb.js +# Copy in portalled packages. COPY --from=bb.js /usr/src/barretenberg/ts /usr/src/barretenberg/ts -# Copy in noir packages COPY --from=noir-packages /usr/src/noir/packages /usr/src/noir/packages -# Copy in noir projects -COPY --from=noir-projects /usr/src/noir-projects /usr/src/noir-projects -# Copy in boxes -COPY --from=boxes-files /usr/src/boxes /usr/src/boxes # We install a symlink to yarn-project's node_modules at a location that all portalled packages can find as they # walk up the tree as part of module resolution. The supposedly idiomatic way of supporting module resolution @@ -88,11 +78,5 @@ RUN yarn --immutable && rm -rf /root/.cache/puppeteer && /bin/bash -c '\ [[ $F =~ (.*-) ]] && ln $F /root/.yarn/berry/cache/${BASH_REMATCH[1]}8.zip; \ done' -# If everything's worked properly, we should no longer need access to the network. -RUN echo "enableNetwork: false" >> .yarnrc.yml - # Check package.json inheritance and tsconfig project references. -RUN yarn prepare:check - -# Generate L1 contract TypeScript artifacts. -RUN cd l1-artifacts && ./scripts/generate-artifacts.sh && rm -rf /usr/src/l1-contracts \ No newline at end of file +RUN yarn prepare:check \ No newline at end of file