我正在将 VueJS 应用程序从“经典”Yarn 1.x 迁移到 Yarn 2。按照安装文档进行操作很简单,并且可以正常工作。
将应用程序打包到 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 零安装设置对于 Docker 映像的样子的信息。
您对如何在 a 中使用 Yarn 2 方法有什么建议Dockerfile
吗?