【发布时间】:2020-08-27 02:42:55
【问题描述】:
大家好,很抱歉这个愚蠢的问题,但这是我使用 Yaml 的第 2 天。
- 问题说明: 我有一个运行 12 分钟的 python 代码(所以我不能使用 Cloud Function 来自动化它),因此使用云构建作为 hack。
- 到目前为止已完成的步骤: 我在谷歌云存储库中有我的代码,我使用云构建来构建图像并创建了谷歌云构建触发器。现在我想在每次触发构建时运行 main.py python 代码(我将使用 Cloud Scheduler 执行此操作,如 here 所述
- 文件夹结构(如下图)
- cloudbuild.yaml 到目前为止我设法编写的
steps:
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: '/bin/bash'
args: ['-c','virtualenv /workspace/venv' ]
# Create a Python virtualenv stored in /workspace/venv that will persist across container runs.
- name: 'gcr.io/$PROJECT_ID/p2p-cloudbuild'
entrypoint: 'venv/bin/pip'
args: ['install', '-V', '-r', 'requirements.txt']
# Installs any dependencies listed in the project's requirements.txt.
问题:如何在 main.py 文件中添加调用/执行“my_function”的步骤?
感谢您的帮助。
【问题讨论】:
标签: python docker google-cloud-platform yaml google-cloud-build