我正在为我的 Elixir 应用程序准备一个 Docker 镜像。我用于esbuild资产编译。
esbuild使用作为npm包安装。
Dockerfile:
# copy umbrella app
COPY ./apps/gpanel ./apps/gpanel
...
# compile assets
RUN mix assets.deploy
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:
# copy umbrella app
COPY ./apps/gpanel ./apps/gpanel
...
# compile assets
RUN mix assets.deploy
Run Code Online (Sandbox Code Playgroud)
经过一番谷歌搜索后,我发现这是一个跨平台构建不兼容的问题。
根本原因是该node_modules文件夹已从我的开发环境复制到 docker 上下文。
添加node_modules即可.dockerignore解决问题。