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 7, 2023
1 parent a6a9303 commit fdbd756
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
25 changes: 21 additions & 4 deletions makeDockerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,14 @@ 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
# install using global cache
RUN --mount=type=cache,target=/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 +120,17 @@ 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
# install using global cache
RUN --mount=type=cache,target=/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 +149,14 @@ 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
# install using global cache
RUN --mount=type=cache,target=/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 fdbd756

Please sign in to comment.