Python Flask 作为 Cloud Foundry 应用程序与作为容器
Python Flask as a Cloud Foundry app vs as a container
我是 IBM Cloud 和云平台的新手,想在 IBM Cloud 上启动我的 Flask 应用程序,我刚开始使用这个 Getting started with Python 但我对它的工作方式感到非常困惑。
Cloud Foundry 的工作方式与容器的工作方式相同吗?
平台如何处理依赖关系以便 Flask 在两种部署方式中使用它们?
你的问题(几乎)太宽泛了。我可以给你一些基本的答案,但当你 运行 进入具体问题时,其他一切都应该是单独的问题。您指的是 Getting Started with Python and Cloud Foundry on IBM Cloud(这是 IBM Cloud 文档,而不是 GitHub 存储库)。
使用 Cloud Foundry (CF) 时,CF 环境和 buildpack 负责处理依赖项。对于 Python,它们在文件 requirements.txt 中指定,并且有文件 manifest.yml 来配置应用程序、它的名称、内存使用情况、域等。当您推送应用程序时(cf push
或 ibmcloud cf push
),这两个文件会被考虑在内,其他一切都会自动完成。这就是Cloud Foundry的魅力。
使用容器,您将编写一个 Dockerfile,然后构建容器镜像,将镜像推送到容器注册表,将容器部署到 Kubernetes。当您构建容器时,您的脚本需要解决依赖关系(基于 requirements.txt)并将必要的模块包含到图像中。
我建议阅读 Deploy an Application Cloud Foundry doc as a starter to give some more background. There is also a simple IBM Cloud solution tutorial that walks you through the steps of deploying a Flask app with a Db2 database. That same site with IBM Cloud solution tutorials 也有按部署选项(Cloud Foundry、Kubernetes、Cloud Functions 等)的教程概述。
我是 IBM Cloud 和云平台的新手,想在 IBM Cloud 上启动我的 Flask 应用程序,我刚开始使用这个 Getting started with Python 但我对它的工作方式感到非常困惑。
Cloud Foundry 的工作方式与容器的工作方式相同吗?
平台如何处理依赖关系以便 Flask 在两种部署方式中使用它们?
你的问题(几乎)太宽泛了。我可以给你一些基本的答案,但当你 运行 进入具体问题时,其他一切都应该是单独的问题。您指的是 Getting Started with Python and Cloud Foundry on IBM Cloud(这是 IBM Cloud 文档,而不是 GitHub 存储库)。
使用 Cloud Foundry (CF) 时,CF 环境和 buildpack 负责处理依赖项。对于 Python,它们在文件 requirements.txt 中指定,并且有文件 manifest.yml 来配置应用程序、它的名称、内存使用情况、域等。当您推送应用程序时(
cf push
或ibmcloud cf push
),这两个文件会被考虑在内,其他一切都会自动完成。这就是Cloud Foundry的魅力。使用容器,您将编写一个 Dockerfile,然后构建容器镜像,将镜像推送到容器注册表,将容器部署到 Kubernetes。当您构建容器时,您的脚本需要解决依赖关系(基于 requirements.txt)并将必要的模块包含到图像中。
我建议阅读 Deploy an Application Cloud Foundry doc as a starter to give some more background. There is also a simple IBM Cloud solution tutorial that walks you through the steps of deploying a Flask app with a Db2 database. That same site with IBM Cloud solution tutorials 也有按部署选项(Cloud Foundry、Kubernetes、Cloud Functions 等)的教程概述。