将rasa部署到App引擎时,Google云构建权限错误

相逢意气为君饮,系马高楼垂柳边。这篇文章主要讲述将rasa部署到App引擎时,Google云构建权限错误相关的知识,希望能为你提供帮助。
我正在尝试将描述为here的rasa项目部署到google app引擎,但是由于某些权限问题,构建失败
脚本试图在容器内创建一个文件夹,

FROM rasa/rasa ENV BOT_ENV=productionCOPY . /var/www WORKDIR /var/wwwRUN rasa trainENTRYPOINT [ "rasa", "run", "-p", "8080"]

我已向Google Cloud build添加以下权限。
将rasa部署到App引擎时,Google云构建权限错误

文章图片

将rasa部署到App引擎时,Google云构建权限错误

文章图片

来自云构建的错误日志。
Epochs: 100%|██████████| 100/100 [00:16< 00:00,6.04it/s, t_loss=1.485, i_loss=0.104, i_acc=1.000] 2020-05-31 18:05:25 INFOrasa.utils.tensorflow.models- Finished training. 2020-05-31 18:05:25 INFOrasa.nlu.model- Finished training component. 2020-05-31 18:05:25 INFOrasa.nlu.model- Starting to train component EntitySynonymMapper 2020-05-31 18:05:25 INFOrasa.nlu.model- Finished training component. 2020-05-31 18:05:25 INFOrasa.nlu.model- Starting to train component ResponseSelector 2020-05-31 18:05:25 INFOrasa.nlu.selectors.response_selector- Retrieval intent parameter was left to its default value. This response selector will be trained on training examples combining all retrieval intents. 2020-05-31 18:05:25 INFOrasa.nlu.model- Finished training component. 2020-05-31 18:05:25 INFOrasa.nlu.model- Successfully saved model into '/tmp/tmpha6sd3hw/nlu' Training Core model... Core model training completed. Training NLU model... NLU model training completed. Traceback (most recent call last): File "/opt/venv/bin/rasa", line 8, in < module> sys.exit(main()) File "/opt/venv/lib/python3.7/site-packages/rasa/__main__.py", line 108, in main cmdline_arguments.func(cmdline_arguments) File "/opt/venv/lib/python3.7/site-packages/rasa/cli/train.py", line 77, in train nlu_additional_arguments=extract_nlu_additional_arguments(args), File "/opt/venv/lib/python3.7/site-packages/rasa/train.py", line 52, in train nlu_additional_arguments=nlu_additional_arguments, File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete File "/opt/venv/lib/python3.7/site-packages/rasa/train.py", line 107, in train_async nlu_additional_arguments=nlu_additional_arguments, File "/opt/venv/lib/python3.7/site-packages/rasa/train.py", line 206, in _train_async_internal fixed_model_name=fixed_model_name, File "/opt/venv/lib/python3.7/site-packages/rasa/model.py", line 464, in package_model create_package_rasa(train_path, output_directory, fingerprint) File "/opt/venv/lib/python3.7/site-packages/rasa/model.py", line 258, in create_package_rasa os.makedirs(output_directory) File "/usr/local/lib/python3.7/os.py", line 223, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: 'models' The command '/bin/bash -o pipefail -c rasa train' returned a non-zero code: 1 ERROR ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

从云shell执行gcloud app deploy时也面临相同的问题
my repo源代码,需要删除cloudbuild.yaml,然后再运行gcloud app deploy
答案这是由于docker的权限问题,通过添加USER root修复的> 【将rasa部署到App引擎时,Google云构建权限错误】FROM rasa/rasa USER root ENV BOT_ENV=productionCOPY . /var/www WORKDIR /var/wwwRUN rasa trainENTRYPOINT [ "rasa", "run", "-p", "8080"]

    推荐阅读