【发布时间】:2018-10-05 22:20:13
【问题描述】:
我的yarn installs 现在需要大约 5 分钟。我正在想办法减少它们。
现在在我的 Dockerfile 中有以下内容:
COPY package.json yarn.lock node_modules /usr/src/app/
COPY ${YARN_CACHE} /root/.cache/yarn/
WORKDIR /usr/src/app
# We are doing this so that we can make use of layer caching
# (i.e. most likely yarn deps won't change as often as the app code)
COPY . /usr/src/app
# yarn install
RUN yarn install
在我的圈子文件中,我有
- restore_cache:
keys:
# only restores cache if the yarn file is the same
- yarn-packages-v4-{{ checksum "yarn.lock" }}
- run: docker pull "xxx.dkr.ecr.us-east-1.amazonaws.com/website:latest"
- run: docker build --build-arg NODE_ENV=production --build-arg YARN_CACHE=$(yarn cache dir) --force-rm -t xxx.dkr.ecr.us-east-1.amazonaws.com/website:build-${CIRCLE_BUILD_NUM} .
但是我的 yarn install 仍然需要 5 分钟。我是不是做错了什么?
【问题讨论】: