Google Cloud 的 Buildpack 是一个开源项目,可获取应用源代码并将其转换为可用于生产用途的容器映像。 Google Cloud 发布的 Buildpack 实现了云原生 Buildpack 规范,旨在帮助您构建和配置可部署到 Google Cloud的容器。
Buildpack 通常负责语言组件、工具链或应用组件,例如 Python、pip 或 Web 服务器。Buildpack 分组为名为构建器的集合,这些集合可以分析项目源代码、创建构建计划,以及生成可进行部署的容器映像。
使用 Buildpack 进行容器化
当您在 Google Cloud 无服务器产品中部署应用(服务)或函数时,代码会使用 Buildpack 打包到可运行的容器中。在 Cloud Run 上,您可以选择部署预构建容器或部署源代码,让 Cloud Run 管理容器构建。在 Cloud Run functions 和 App Engine 上,容器化过程是完全托管的,这意味着当您部署源代码时,系统会为您完成所有容器映像打包和转换工作。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eGoogle Cloud's buildpacks are an open-source project that transforms application source code into production-ready container images, based on the Cloud Native Buildpack specification.\u003c/p\u003e\n"],["\u003cp\u003eBuildpacks are responsible for language components or tools, and are grouped into builders that analyze code and generate deployable container images.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud Serverless products use buildpacks to package code into runnable containers, and the process is fully managed on Cloud Run functions and App Engine.\u003c/p\u003e\n"],["\u003cp\u003eBuilders and buildpacks are pre-configured to handle the build process and automatically detect the programming language, supporting multiple languages.\u003c/p\u003e\n"],["\u003cp\u003eBuildpacks can be used to build both applications/services and functions, and a \u003ccode\u003eProcfile\u003c/code\u003e can define the startup process for containers, being mandatory for some languages like Python.\u003c/p\u003e\n"]]],[],null,["# Google Cloud's buildpacks is an\n[open-source project](https://github.com/GoogleCloudPlatform/buildpacks)\nthat takes your application source code and transforms it into production-ready\ncontainer images. The buildpacks published by Google Cloud implement\nthe\n[Cloud Native Buildpack specification](https://buildpacks.io/)\nand are designed to help you build and configure containers that you can\ndeploy to Google Cloud.\n\nA buildpack is typically responsible for a language\ncomponent, toolchain, or app component; such as Python, `pip`, or a web server.\nBuildpacks are grouped together into collections called\n[builders](/docs/buildpacks/builders) that can analyze project source code,\ncreate a build plan, and generate a container image that is ready for deployment.\n\nContainerization with buildpacks\n--------------------------------\n\nWhen you deploy to and serve your application (service) or function on the\n[Google Cloud Serverless](https://cloud.google.com/serverless) products,\nyour code gets packaged into a runnable container using buildpacks.\nOn Cloud Run, you have the option to deploy a pre-built container or\n[deploy your source code](https://cloud.google.com/run/docs/deploying-source-code)\nto let Cloud Run manage the container build. On Cloud Run functions and\nApp Engine, the containerization process is fully-managed, meaning that when\nyou deploy your source code, all the container image packaging and converting\nis done for you.\n\nEach container image gets built with all the components needed for running your\ndeployment, including source code, system and library dependencies, configuration\ndata, and static assets. By default, the Google Cloud Serverless products\nuse the same underlying services, including Cloud Build for the deployment\npipeline, and either Container Registry or Artifact Registry for container image storage\nand management.\n\nWhen using Google Cloud's buildpacks:\n\n- Builders and buildpacks are pre-configured to handle the build process and create a runnable container image for you.\n- Buildpacks support [multiple programming languages](/docs/buildpacks/builders) and automatically detects which lanaguage is used in your source code.\n- You can [customize and extend buildpacks](/docs/buildpacks/build-run-image) to install additional system dependencies. However, the default builder can handle the common tasks required by your programming language, including installing dependencies from the language's package repository and using the language's common dependency file.\n\nUse buildpacks to containerize your code\n----------------------------------------\n\nBuildpacks can be used locally or remotely to:\n\n- [Build an application or service](/docs/buildpacks/build-application)\n- [Build a function](/docs/buildpacks/build-function)\n\nFor programming languages that exclude a standard ways to start an application,\nyou can use a `Procfile` to define the process to invoke when a container starts.\nA `Procfile` can be used to override the default start process for any\nbuildpacks type, but is mandatory for some, including\n[Python](https://cloud.google.com/docs/buildpacks/python#application_entrypoint).\n\nWhat's next\n-----------\n\n- [Builders](/docs/buildpacks/builders)\n- [Build an application](/docs/buildpacks/build-application)\n- [Build a function](/docs/buildpacks/build-function)\n- Learn about [Cloud Native Buildpacks](https://buildpacks.io/docs/for-platform-operators/concepts/)"]]