angular - 无法在 Google Run 上部署 angular-app
问题描述
用于在 Google Run 上部署应用程序。我创建了具有以下内容的 Dockerfile:
### STAGE 1: Build ###
FROM node:latest AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
### STAGE 2: Run ###
FROM nginx:1.19.9-alpine
COPY --from=build /app/dist/aistudio /usr/share/nginx/html
线上出现的问题RUN npm run build
。控制台上显示的日志是:
=> ERROR [build 4/6] RUN npm install 352.3s
------
> [build 4/6] RUN npm install:
#12 350.8 npm notice
#12 350.8 npm notice New minor version of npm available! 7.7.6 -> 7.8.0
#12 350.8 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.8.0>
#12 350.8 npm notice Run `npm install -g npm@7.8.0` to update!
#12 350.8 npm notice
#12 350.8 npm ERR! code ECONNRESET
#12 350.9 npm ERR! network aborted
#12 350.9 npm ERR! network This is a problem related to network connectivity.
#12 350.9 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#12 350.9 npm ERR! network
#12 350.9 npm ERR! network If you are behind a proxy, please make sure that the
#12 350.9 npm ERR! network 'proxy' config is set properly. See: 'npm help config'
#12 351.3
#12 351.3 npm ERR! A complete log of this run can be found in:
#12 351.3 npm ERR! /root/.npm/_logs/2021-04-04T08_36_13_047Z-debug.log
------
executor failed running [/bin/sh -c npm install]: exit code: 1
任何帮助,将不胜感激。这样我就可以成功构建 Angular docker 映像,然后将其部署在 Google Run 上。谢谢
已编辑
当我有下面给出的简单 Dockerfile 时,docker 映像构建并成功运行。
FROM nginx:alpine
COPY /dist/aistudio /usr/share/nginx/html
解决方案
推荐阅读
- python - 如何制作重复列表直到一定数量的项目
- c# - 如何在具有不同材质的物体上投射特定材质?
- php - 错误 #1050 表“名称”已经存在,而我有一个空数据库
- vba - 关闭 MS Access 表单而不保存任何脏数据
- postgresql - Postgres:在 ON CONFLICT 中使用 MAX
- python - 使用 id 更改 Kivy TextInput 小部件的文本时出现问题:引发错误“AttributeError: 'super' object has no attribute '__getattr__'”
- django - 如何正确允许 django rest 框架中的 post 请求?
- python - 哪种算法可以用来构建复杂的子树?
- python - 删除字典中的多个键
- r - 刮桌背心