node.js - Gcloud app deploy 不能忽略 Dockerfile
问题描述
我通常将我的NodeJS应用程序部署到 Google App Engine 并在通过文件部署时忽略所有 docker 资产,.gcloudignore
如下所示:
.git
.gitignore
Dockerfile
docker-compose.yml
nginx/
redis-data/
.vscode/
.DS_Store
.prettierrc
README.md
node_modules/
.env
上周我成功地将我的应用程序部署到 App Engine,没有任何问题。但是今天(除了源代码没有任何更改)它失败并给我一个错误:
ERROR: (gcloud.app.deploy) There is a Dockerfile in the current directory, and the runtime field in /Users/tranphongbb/Works/unstatic/habitify-annual-report-backend/app.yaml is currently set to [runtime: nodejs]. To use your Dockerfile to build a custom runtime, set the runtime field to [runtime: custom]. To continue using the [nodejs] runtime, please remove the Dockerfile from this directory.
即使删除.gcloudignore
文件并使用 中的skip_files
选项app.yaml
,它仍然失败。
我的源代码树:
.dockerignore
.eslintrc.json
.gcloudignore
.gitignore
.prettierrc
.vscode
Dockerfile
README.md
app.yaml
docker-compose.yml
nginx
package.json
src
解决方案
我通过克隆 Node.js App Engine Flex Quickstart 并将 Dockerfile 添加到与 app.yaml 文件相同的文件夹中重现了您的问题。确实,我收到了与您相同的错误消息。但是我可以看到,如果我将 Dockerfile 移动到不同的目录,则部署成功。似乎 gcloud app deploy 不尊重 .gcloudignore 文件。
对于柔性环境中的 node.js, App Engine 官方文档中没有 skip_files 条目。
要忽略 .gcloudignore 文件中定义的文件,请运行gcloud beta app deploy
在 app.yaml 中使用 Nodejs Runtime 时对我有用的命令以忽略 Dockerfile,或者您可以使用gcloud app deploy
命令但将 Dockerfile 移动到另一个目录。
推荐阅读
- r - 分份'?基于正态分布的值
- c# - .NET Core WebApi Get HttpClient Error Message
- python - 如何将可变长度的numpy ndarray附加到一个空的numpy数组?
- r - 以向量为参数的 RSQLite 参数化查询
- asp.net-core - AspNetCore 无法在过滤器中设置 cookie
- java - How can you determine all of the places AWS access key values are used in a project in Java?
- c# - 此错误的来源是什么:没有与目标匹配的签名?
- angular - 更改第一个属性时,PrimeNg 表延迟加载未触发
- python - Python:如何修复进程内的随机种子?
- nested - 多个 httpclient 请求,依赖于使用 observables 的另一个 httpclient 请求的数据