Home

Awesome

Heroku Cloud Native Buildpacks: Ruby

Cloud Native Buildpacks Registry: heroku/ruby CI on GitHub Actions: heroku/ruby

Heroku Cloud Native Buildpack: heroku/ruby

Build your Ruby and Rails application source code into an OCI image with minimal configuration, no Dockerfile required. To learn more about what a CNB is, how they work, and how to use one to build your application, see the Heroku CNB documentation.

[!IMPORTANT] This is a collection of Cloud Native Buildpacks, and is a component of the Heroku Cloud Native Buildpacks project, which is in preview. If you are instead looking for the Heroku Classic Buildpack for Ruby (for use on the Heroku platform), you may find it here. To read about differences between the buildpacks see docs/upgrading.md.

Usage

[!NOTE] Before getting started, ensure you have the pack CLI installed.

To build a Ruby application codebase into a production image:

$ cd ~/workdir/sample-ruby-app
$ pack build sample-app --builder heroku/builder:24

[!NOTE] You can skip needing to pass the --builder flag by setting a default builder with pack config default-builder heroku/builder:24.

Then run the image:

docker run --rm -it -e "PORT=9292" -p 9292:9292 sample-app

For detailed usage documentation see Heroku Cloud Native Buildpacks.

Application Requirements

The heroku/ruby buildpack requires applications have a valid Gemfile and Gemfile.lock in the root of their project.

For more details you can view the Ruby buildpack's specification which goes into detail on buildpack behavior and enumerates the expected contract between your application and the buildpack.

Configuration

Ruby version

To select a Ruby version, specify it in your Gemfile like this:

ruby "3.3.0"

And ensure it is in your Gemfile.lock by running:

$ bundle update --ruby

You should see a section in the Gemfile.lock that corresponds to your Ruby version:

RUBY VERSION
   ruby 3.3.0p0

If no Ruby version is found in the Gemfile.lock a default version of Ruby will be provided. We highly suggest specifying a version to prevent surprise changes.

Bundler version

To select a Bundler version, ensure your Gemfile.lock contains a locked value. For example:

BUNDLED WITH
   2.5.6

If no Bundler version is found in the Gemfile.lock a default version of Bundler will be provided. We highly suggest specifying a version to prevent surprise changes.

For more details you can view the Ruby buildpack's specification which goes into detail on buildpack behavior and enumerates the expected contract between your application and the buildpack.

Included Buildpacks

The heroku/ruby buildpack is a standalone buildpack. This is in contrast to some other buildpacks that are composed of several smaller buildpacks such as heroku/nodejs.

Contributing

Issues and pull requests are welcome. See our contributing guidelines if you would like to help.