【发布时间】:2019-05-07 02:00:37
【问题描述】:
我正在尝试将 React 应用的生产版本(使用 create-react-app 创建)部署到 gcloud 应用引擎灵活环境。
运行npm run build后,构建文件夹就创建好了:
这是我的 app.yaml:
# [START runtime]
runtime: nodejs
env: flex
# [END runtime]
# [START handlers]
handlers:
- url: /
static_files: build/index.html
upload: build/index.html
- url: /
static_dir: build
# [END handlers]
部署到 App Engine 时,版本配置显示:
runtime: nodejs
api_version: '1.0'
env: flexible
threadsafe: true
handlers:
- url: /
application_readable: false
static_files: build/index.html
require_matching_file: false
upload: build/index.html
- url: '/(.*)'
application_readable: false
static_files: "build/\\1"
require_matching_file: false
upload: 'build/.*'
automatic_scaling:
min_num_instances: 2
max_num_instances: 20
cpu_utilization:
target_utilization: 0.5
正在提供开发应用程序,而不是构建文件夹中的生产版本。我做错了什么?
【问题讨论】:
标签: reactjs google-app-engine google-cloud-platform gcloud app-engine-flexible