【问题标题】:Google App Engine - Node.js entrypoint as defined in the app.yaml isn't triggeringGoogle App Engine - app.yaml 中定义的 Node.js 入口点未触发
【发布时间】:2021-10-14 11:48:22
【问题描述】:

我有一个使用 gcr.io/google-appengine/nodejs 进行 Docker 化的 node.js 应用程序,并且部署和运行良好。知道默认情况下 GAE 将运行 package.json 中的“启动”脚本,我只是用运行没问题的next start -p 8080 替换了已经存在的脚本。

我想触发一个替代脚本而不是“启动”,因此我创建了一个名为“cloud-start”的脚本并将上述命令作为值插入。在 app.yaml 中,我添加了“入口点”属性和 yarn cloud-run 作为值:

runtime: custom
env: flex
entrypoint: yarn cloud-start
service: my-app

vm_health_check:
 enable_health_check: False

manual_scaling:
  instances: 1

resources:
  memory_gb: 4

“cloud-start”脚本从未执行过——我什至尝试用“npm”替换“yarn”,但仍然没有成功。为什么我的入口点不会触发?

这是我的 Dockerfile,以防万一:

# Use the base App Engine Docker image, based on Ubuntu 16.0.4.
FROM gcr.io/google-appengine/nodejs

# Install locate for debugging purposes
RUN apt-get update -y && \
    apt-get install --no-install-recommends -y -q \
    locate

COPY . /app
WORKDIR /app
RUN  npm install --global yarn
RUN yarn
RUN yarn static

EXPOSE 8080

【问题讨论】:

  • 你能编辑你的问题并包含 package.json 文件吗?还包括来自应用引擎日志的错误消息。

标签: reactjs docker google-app-engine next.js app.yaml


【解决方案1】:

试试entrypoint: npm run cloud-start 它对我有用。

这个答案的解释可以在这里找到:https://issuetracker.google.com/issues/110097743#comment11

yarn 仅在构建时可用以安装您的依赖项。之后,yarn 可执行文件在 Node.js 运行时中不可用。

如果你想运行你的“dev”脚本,只需使用“start”:“npm run dev”

【讨论】:

    猜你喜欢
    • 2021-01-31
    • 2021-07-31
    • 2022-06-23
    • 1970-01-01
    • 1970-01-01
    • 2019-09-13
    • 2013-04-09
    • 1970-01-01
    • 2019-03-27
    相关资源
    最近更新 更多