[[["易于理解","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-08-18。"],[[["\u003cp\u003eRuby buildpacks support the current and Active LTS releases of Ruby, and older versions are available but may not be actively maintained.\u003c/p\u003e\n"],["\u003cp\u003eIf a \u003ccode\u003eGemfile.lock\u003c/code\u003e file exists, the Ruby version specified within it will be automatically used, and the \u003ccode\u003eGOOGLE_RUNTIME_VERSION\u003c/code\u003e environment variable will be ignored if bundler is used.\u003c/p\u003e\n"],["\u003cp\u003eIf bundler is not in use, you can specify the Ruby version using the \u003ccode\u003eGOOGLE_RUNTIME_VERSION\u003c/code\u003e environment variable, either directly or in a \u003ccode\u003eproject.toml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eProcfile\u003c/code\u003e can be used to define an entrypoint for your application, with the \u003ccode\u003eweb\u003c/code\u003e target being the default, or a different target can be selected via the command line.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGOOGLE_ENTRYPOINT\u003c/code\u003e environment variable can override any entrypoint specified in a \u003ccode\u003eProcfile\u003c/code\u003e or be used as an entrypoint if no \u003ccode\u003eProcfile\u003c/code\u003e exists.\u003c/p\u003e\n"]]],[],null,["# Building a Ruby application\n\nSpecifying Versions of Ruby\n---------------------------\n\nThe buildpacks project provides support for the current release and Active LTS release of Ruby. Older releases of Ruby are available but may not be actively maintained by the project.\n\n### Using `Gemfile.lock`\n\nIf your application uses bundler, you should have Gemfile.lock at the root of your repo. Ruby buildpacks will automatically use a version that's locked in your Gemfile.lock.\nFor example, if your Gemfile.lock has the following: \n\n RUBY VERSION\n ruby 3.0.3p0\n\nThe buildpacks will automatically use Ruby 3.0.3, with the latest patch level.\n\n### Using `GOOGLE_RUNTIME_VERSION`\n\nIf you're not using bundler, you can specify a ruby version using the environment variable as follows: \n\n pack build --builder=gcr.io/buildpacks/builder \\\n sample-ruby \\\n --env GOOGLE_RUNTIME_VERSION=3.0.3\n\n\nYou can also use a `project.toml` project descriptor to encode\nthe environment variable alongside your project files. See instructions on\n[building the application with environment variables](/docs/buildpacks/set-environment-variables#build_the_application_with_environment_variables)).\n\nIf you're using bundler,`GOOGLE_RUNTIME_VERSION` can't be used to override the specified version in Gemfile.lock\nunder `RUBY VERSION`.\n\nInstalling Dependencies\n-----------------------\n\n### Using Bundler\n\n- [Bundler](https://bundler.io) is the default package manager\n- Commit `Gemfile.lock` to your repo since we use the lock file to build the app\n- By default only production dependencies are installed\n\n### Bundler Version\n\nBundler has known [compatibility issues](https://bundler.io/compatibility).\nIf your application uses bundler, due to various compatibility issues with Ruby and Rubygems, we update\nthe Gemfile.lock in the built app to use one of the two supported versions.\nAll applications using bundler 1.\\* and 2.\\* in `BUNDLED WITH` are normalized to use bundler 1.17.3 and 2.3.15.\n\nSpecifying an Entrypoint\n------------------------\n\n### Using Procfile\n\nYou can specify an entrypoint, a command that runs when the container starts, using Procfile.\nFor example, with the following in your Procfile at the root of your app: \n\n web: ruby main.rb\n\nThe Ruby buildpack will use the command `ruby main.rb` as the entrypoint of the built container.\nBy default the `web` target from the Procfile is used.\n\nTo use a different entrypoint, you can specify a different target from your\nProcfile as an argument.\n\nWith a Procfile containing the following:\n`web: ruby main.rb\ncustom: ruby custom.rb`\n\nYou can use the custom Procfile target by passing it as an argument:\n`bash\npack build --builder=gcr.io/buildpacks/builder \\\nsample-ruby \\\n--entrypoint=custom`\n\n### Using `GOOGLE_ENTRYPOINT`\n\nIf you're not using a Procfile or want to override the Procfile, you can specify an entrypoint\nusing the `GOOGLE_ENTRYPOINT` environment variable. Here's an example: \n\n pack build --builder=gcr.io/buildpacks/builder \\\n sample-ruby \\\n --env GOOGLE_ENTRYPOINT=\"ruby custom.rb\"\n\nEnvironment Variables\n---------------------\n\nThe Ruby buildpack supports the following environment variables to customize your container\n\n### BUNDLE_\n\nSee `bundler` [documentation](https://bundler.io/v2.0/man/bundle-config.1.html).\n\n**Example:** `BUNDLE_TIMEOUT=60` sets `--timeout=60` for `bundle` commands."]]