Next, you will want to actually detect that the app you are building is a Ruby app. In order to do this, you will need to check for a
exit 1 in the
detect script with the following check:
if [[ ! -f Gemfile ]]; then exit 100 fi
ruby-buildpack/bin/detect script should look like this:
#!/usr/bin/env bash set -eo pipefail if [[ ! -f Gemfile ]]; then exit 100 fi
Next, rebuild your app with the updated buildpack:
pack build test-ruby-app --path ./ruby-sample-app --buildpack ./ruby-buildpack
You should see the following output:
Previous image with name "test-ruby-app" not found ===> DETECTING examples/ruby 0.0.1 ===> RESTORING ===> BUILDING ---> Ruby Buildpack ERROR: failed to build: exit status 1 ERROR: failed to build: executing lifecycle: failed with status code: 51
detect now passes because there is a valid
Gemfile in the Ruby app at
ruby-sample-app, but now
build fails because it is currently written to error out.
You will also notice that
RESTORING now appears in the build output. This step is part of the buildpack lifecycle that looks to see if any previous image builds have layers that the buildpack can re-use. We will get into this topic in more detail later.