如何验证纱线真的正在使用缓存文件夹?

发布于 2025-02-07 04:36:25 字数 847 浏览 1 评论 0原文

我正在使用Docker为一个NextJS项目安装依赖项。 每当我运行此自定义CI时,我可能会永远使用纱线安装 3分钟前。该机器具有持久的存储空间,我正在当地机器构建包装。

如何验证缓存是否使用?

我的命令是:

docker container run --rm --entrypoint='' -u root \
                  --platform linux/amd64 \
                  -v .:/usr/src/app \
                  -v ~/yarn-cache:/yarn-cache \
                  -w /usr/src/app \
                  node:16.4.0 /bin/bash -c 'YARN_CACHE_FOLDER=/yarn-cache yarn install'

请注意,我将卷〜 /YARN-CACHE附加到Docker Container /Yarn-Cache 然后,在运行YARN安装之前,请与Env varialbe在YARN中记录的CACHE文件夹,

YARN_CACHE_FOLDER=/yarn-cache

该文件夹〜/YARN-CACHE已经存在于主机计算机中,并且从未使用或填充数据...

因此,根据我的理解YARN < /code> 在docker容器中运行不使用我使用yarn_cache_folder =/yarn-cache在命令本身yarn install install

I am using docker to install dependencies for one nextjs project.
Every time I run this custom CI it takes forever, although I might have installed the yarn install 3 minutes ago. The machine has persistent storage, I am building the packages from my local machine.

How can I verify that the cache is used or not?

My command is:

docker container run --rm --entrypoint='' -u root \
                  --platform linux/amd64 \
                  -v .:/usr/src/app \
                  -v ~/yarn-cache:/yarn-cache \
                  -w /usr/src/app \
                  node:16.4.0 /bin/bash -c 'YARN_CACHE_FOLDER=/yarn-cache yarn install'

Please take note I am attaching the volume ~/yarn-cache to docker container /yarn-cache
then before running yarn install am specifying the cache folder as documented in yarn with the env varialbe

YARN_CACHE_FOLDER=/yarn-cache

The folder ~/yarn-cache exists already in host machine and is never used or filled with data...

So from my understanding yarn that runs inside docker container is not using the cache folder that I specify with YARN_CACHE_FOLDER=/yarn-cache before the command itself yarn install

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文