【发布时间】:2021-10-27 07:17:27
【问题描述】:
我正在将 VueJS 应用程序从“经典”Yarn 1.x 迁移到 Yarn 2。遵循 install documentation 很简单,并且可以正常工作。
将应用程序打包到 Docker 映像中时会遇到棘手的问题。
当前 Dockerfile
FROM node:14-alpine AS build-stage
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . ./
RUN yarn build --modern \
&& find dist -type f -exec gzip -k "{}" \;
FROM nginx:mainline-alpine as production-stage
RUN apk add --no-cache curl
HEALTHCHECK CMD curl -f http://localhost || exit 1
COPY docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
COPY docker/app.nginx /etc/nginx/conf.d/default.conf
COPY --from=build-stage /app/dist /usr/share/nginx/html
ENTRYPOINT [ "/entrypoint.sh" ]
也许我看错了地方,但我找不到任何信息,Yarn 2 Zero-Install setup 看起来像 Docker 映像。
您对如何在Dockerfile 中使用 Yarn 2 方法有什么建议吗?
【问题讨论】:
标签: yarnpkg yarnpkg-v2