From b49179341338bbbf0a88e20db63f9da5f0393215 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 6 Nov 2023 14:47:33 -0800 Subject: [PATCH] build: yarn install with mount-type=cache --- makeDockerfile.ts | 22 ++++++++++++++++++---- proposals/34:upgrade-10/use.sh | 2 -- proposals/43:upgrade-11/use.sh | 2 -- proposals/55:statom-vaults/eval.sh | 2 -- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/makeDockerfile.ts b/makeDockerfile.ts index 9918fb54..9f16b177 100755 --- a/makeDockerfile.ts +++ b/makeDockerfile.ts @@ -93,8 +93,13 @@ FROM use-${lastProposal.proposalName} as eval-${proposalName} COPY --link --chmod=755 ./proposals/${proposalIdentifier}:${proposalName} /usr/src/proposals/${proposalIdentifier}:${proposalName} -COPY --link --chmod=755 ./upgrade-test-scripts/run_eval.sh /usr/src/upgrade-test-scripts/run_eval.sh +RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \ + cd /usr/src/upgrade-test-scripts/lib/ \ + && yarn install \ + && cd /usr/src/proposals/${proposalIdentifier}:${proposalName} \ + && test -n "yarn.lock" && yarn install --frozen-lockfile --production +COPY --link --chmod=755 ./upgrade-test-scripts/run_eval.sh /usr/src/upgrade-test-scripts/run_eval.sh WORKDIR /usr/src/upgrade-test-scripts SHELL ["/bin/bash", "-c"] RUN ./run_eval.sh ${proposalIdentifier}:${proposalName} @@ -114,12 +119,16 @@ FROM ${previousStage}-${proposalName} as use-${proposalName} COPY --link --chmod=755 ./proposals/${proposalIdentifier}:${proposalName} /usr/src/proposals/${proposalIdentifier}:${proposalName} -COPY --link --chmod=755 ./upgrade-test-scripts/run_use.sh /usr/src/upgrade-test-scripts/run_use.sh # XXX for 'lib' dir for JS modules COPY --link ./upgrade-test-scripts/lib /usr/src/upgrade-test-scripts/lib # TODO remove network dependencies in stages -RUN cd /usr/src/upgrade-test-scripts/lib/ && yarn install +RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \ + cd /usr/src/upgrade-test-scripts/lib/ \ + && yarn install \ + && cd /usr/src/proposals/${proposalIdentifier}:${proposalName} \ + && test -n "yarn.lock" && yarn install --frozen-lockfile --production +COPY --link --chmod=755 ./upgrade-test-scripts/run_use.sh /usr/src/upgrade-test-scripts/run_use.sh WORKDIR /usr/src/upgrade-test-scripts SHELL ["/bin/bash", "-c"] RUN ./run_use.sh ${proposalIdentifier}:${proposalName} @@ -138,8 +147,13 @@ RUN ./run_use.sh ${proposalIdentifier}:${proposalName} # TEST ${proposalName} FROM use-${proposalName} as test-${proposalName} -COPY --link --chmod=755 ./upgrade-test-scripts/run_test.sh /usr/src/upgrade-test-scripts/run_test.sh +RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \ + cd /usr/src/upgrade-test-scripts/lib/ \ + && yarn install \ + && cd /usr/src/proposals/${proposalIdentifier}:${proposalName} \ + && test -n "yarn.lock" && yarn install --frozen-lockfile --production +COPY --link --chmod=755 ./upgrade-test-scripts/run_test.sh /usr/src/upgrade-test-scripts/run_test.sh WORKDIR /usr/src/upgrade-test-scripts SHELL ["/bin/bash", "-c"] ENTRYPOINT ./run_test.sh ${proposalIdentifier}:${proposalName} diff --git a/proposals/34:upgrade-10/use.sh b/proposals/34:upgrade-10/use.sh index 27572f4e..45962b45 100644 --- a/proposals/34:upgrade-10/use.sh +++ b/proposals/34:upgrade-10/use.sh @@ -5,8 +5,6 @@ set -e source /usr/src/upgrade-test-scripts/env_setup.sh -yarn install --frozen-lockfile - yarn ava pre.test.js ./performActions.js diff --git a/proposals/43:upgrade-11/use.sh b/proposals/43:upgrade-11/use.sh index 21b6d965..c1bb0c02 100644 --- a/proposals/43:upgrade-11/use.sh +++ b/proposals/43:upgrade-11/use.sh @@ -7,8 +7,6 @@ source /usr/src/upgrade-test-scripts/env_setup.sh ls -al -yarn install --frozen-lockfile - yarn ava pre.test.js ./performActions.js diff --git a/proposals/55:statom-vaults/eval.sh b/proposals/55:statom-vaults/eval.sh index 0cd14131..711850f3 100644 --- a/proposals/55:statom-vaults/eval.sh +++ b/proposals/55:statom-vaults/eval.sh @@ -7,8 +7,6 @@ source /usr/src/upgrade-test-scripts/env_setup.sh ls -al -yarn install --frozen-lockfile - # XXX to avoid rebuilding lower layers # TODO clean up JS lib code so it's more independent cp package.json yarn.lock /usr/src/upgrade-test-scripts/lib/