我正在使用节点 js 后端,我想通过 docker 部署应用程序。
我更改了两个 npm 包以使我的应用程序正常工作,并在我的 package.json 中的安装后脚本的帮助下使用 npm patch-package 自动安装这些更改。
"postinstall": "patch-package"
我将 postinstall-postinstall 和 patch-package 都安装为开发依赖项。
分别运行 yarn install 和 yarn build 可以正常工作,但是一旦我想 dockerize 这个应用程序,我在构建阶段就会收到一个错误,这基本上是说补丁没有应用到 node_modules。
这是我的码头文件:
# stage 1
FROM node as builder
WORKDIR /srv
COPY package.json yarn.lock patches ./
RUN yarn install --frozen-lockfile --unsafe-perm
COPY . .
RUN yarn build
我真的不知道 dockerfile 中的 yarn install 脚本是否没有在安装后运行,或者错误是否只发生在 yarn build 脚本中。
提前致谢