docker镜像中的 Angular 构建错误

标签 angular docker

我有 Angular 6 应用程序。它在本地构建和工作没有问题。

现在我想创建 docker 镜像。我正在关注本指南 https://medium.com/@tiangolo/angular-in-docker-with-nginx-supporting-environments-built-with-multi-stage-docker-builds-bb9f1724e984

问题是应用程序在对其进行 docker 化时找不到某些模块(第 7 步失败)。当我在控制台中从这一步运行命令时,它会正常构建。我该如何处理?我现在正在为此奋斗2天。

enter image description here

Dockerfile:

# Stage 0, "build-stage", based on Node.js, to build and compile the frontend
FROM tiangolo/node-frontend:10 as build-stage

WORKDIR /app

COPY package*.json /app/

RUN npm install

COPY ./ /app/

ARG configuration=production

RUN npm run build -- --output-path=./dist/out --configuration $configuration

# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.15

COPY --from=build-stage /app/dist/out/ /usr/share/nginx/html

# Copy the default nginx.conf provided by tiangolo/node-frontend
COPY --from=build-stage /nginx.conf /etc/nginx/conf.d/default.conf

最佳答案

解决了 OP 的问题,因为它是路径区分大小写的问题。

关于docker镜像中的 Angular 构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52857975/

相关文章:

angular - 无法在重新加载页面上获取/登录 Angular 8 - 拒绝加载图像 '/favicon.ico',因为它违反了以下内容安全策略

angular - 如何改变模态对话框的位置?

mongodb - Kafka 接收器连接器 : No tasks assigned, 即使重启后

python - 导入测试库 'SSHLibrary' 失败,出现 ImportError "Importing Paramiko library failed. Make sure you have Paramiko installed."

docker - 可以在 kubernetes 中将本地镜像用于 pod yaml 吗?

laravel - 经过测试,Chrome进程在Docker容器中仍然保留Laravel Dusk

javascript - 如何在 Angular 5中同步调用http请求

javascript - 无论如何,是否可以使用 Angular2 轻松地将自定义字符串绑定(bind)到 id 和 html 元素中的 for ?

angular - Typescript - 声明类型既不是 'void' 也不是 'any' 的函数必须返回一个值

docker - 当存储库有两个 Docker 镜像(客户端和服务器)时,将 Docker 镜像推送到 Gitlab Registry