Skip to content

Commit

Permalink
build: yarn install with mount-type=cache
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 6, 2023
1 parent 3fbdfa0 commit b491793
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
22 changes: 18 additions & 4 deletions makeDockerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand Down
2 changes: 0 additions & 2 deletions proposals/34:upgrade-10/use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions proposals/43:upgrade-11/use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions proposals/55:statom-vaults/eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit b491793

Please sign in to comment.