我正在尝试将React应用程序的生产版本(使用create-react-app创建)部署到gcloud app引擎灵活的环境。
运行之后npm run build,将创建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]
Run Code Online (Sandbox Code Playgroud)
部署到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
Run Code Online (Sandbox Code Playgroud)
将提供开发应用程序,而不是从构建文件夹提供生产版本。我究竟做错了什么?
google-app-engine reactjs google-cloud-platform gcloud app-engine-flexible