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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将rasa部署到App引擎时,Google云构建权限错误相关的知识,希望对你有一定的参考价值。

我正在尝试将描述为here的rasa项目部署到google app引擎,但是由于某些权限问题,构建失败

脚本试图在容器内创建一个文件夹,

FROM rasa/rasa
ENV BOT_ENV=production

COPY . /var/www
WORKDIR /var/www

RUN rasa train

ENTRYPOINT [ "rasa", "run", "-p", "8080"]

我已向Google Cloud build添加以下权限。

enter image description here

enter image description here

来自云构建的错误日志。

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 INFO     rasa.utils.tensorflow.models  - Finished training.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Finished training component.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Starting to train component EntitySynonymMapper
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Finished training component.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Starting to train component ResponseSelector
2020-05-31 18:05:25 INFO     rasa.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 INFO     rasa.nlu.model  - Finished training component.
2020-05-31 18:05:25 INFO     rasa.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修复的>

FROM rasa/rasa USER root ENV BOT_ENV=production COPY . /var/www WORKDIR /var/www RUN rasa train ENTRYPOINT [ "rasa", "run", "-p", "8080"]

以上是关于将rasa部署到App引擎时,Google云构建权限错误的主要内容,如果未能解决你的问题,请参考以下文章

将基本的 Angular 2 应用程序部署到 Google App Engine

Google的App引擎添加了对Node.js的支持

如何将新服务部署到 Google App Engine 中的现有应用程序?

将简单的 Socket.io Flask 应用程序部署到 Google App Engine:仍未解决

Java堆转储在Google App引擎标准环境中?

Google App Engine cron 作业未显示