Rails app fails during deployment

Followed the steps to migrate an existing rails app to Heroku as described here: Migrate from Heroku · Fly Docs

The fly deploy command fails in the following stage:

 => [internal] load remote build context                                                                                                                                                                   0.0s
 => copy /context /                                                                                                                                                                                        0.1s
 => resolve image config for docker.io/docker/dockerfile:experimental                                                                                                                                      0.6s
 => CACHED docker-image://docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa468e78496ff5                                                                 0.0s
 => [internal] load metadata for quay.io/evl.ms/fullstaq-ruby:2.6.8-jemalloc-bullseye-slim                                                                                                                 0.4s
 => [base 1/5] FROM quay.io/evl.ms/fullstaq-ruby:2.6.8-jemalloc-bullseye-slim@sha256:9d5bc601e01f4a755f3e8a311e06df1a99aaff9c0a8df478d732d71e25676207                                                      0.0s
 => CACHED [base 2/5] RUN mkdir /app                                                                                                                                                                       0.0s
 => CACHED [base 3/5] WORKDIR /app                                                                                                                                                                         0.0s
 => CACHED [base 4/5] RUN mkdir -p tmp/pids                                                                                                                                                                0.0s
 => CACHED [base 5/5] RUN gem update --system --no-document &&     gem install -N bundler -v 1.17.3                                                                                                        0.0s
 => CACHED [stage-3 1/7] RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt     --mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt     apt-get update -qq &  0.0s
 => CACHED [build_deps 1/1] RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt     --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt     apt-get update -qq   0.0s
 => CACHED [gems 1/2] COPY Gemfile* ./                                                                                                                                                                     0.0s
 => CACHED [gems 2/2] RUN bundle install &&  rm -rf vendor/bundle/ruby/*/cache                                                                                                                             0.0s
 => CACHED [stage-3 2/7] COPY --from=gems /app /app                                                                                                                                                        0.0s
 => CACHED [stage-3 3/7] COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions                                                                                                  0.0s
 => CACHED [stage-3 4/7] COPY --from=gems /usr/local/bundle /usr/local/bundle                                                                                                                              0.0s
 => CACHED [stage-3 5/7] COPY . .                                                                                                                                                                          0.0s
 => ERROR [stage-3 6/7] RUN chmod +x /app/bin/* &&     sed -i 's/ruby.exe\r*/ruby/' /app/bin/* &&     sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*                                  0.3s
------
 > [stage-3 6/7] RUN chmod +x /app/bin/* &&     sed -i 's/ruby.exe\r*/ruby/' /app/bin/* &&     sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*:
#19 0.262 chmod: cannot access '/app/bin/*': No such file or directory
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c chmod +x /app/bin/* &&     sed -i 's/ruby.exe\r*/ruby/' /app/bin/* &&     sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*]: exit code: 1

If I’m reading this correctly, your Rails app doesn’t have a bin directory? That would be unusual. Can you confirm?

 => CACHED [base 2/5] RUN mkdir /app                                                                                                                                                                       0.0s
 => CACHED [base 3/5] WORKDIR /app                                                                                                                                                                         0.0s
 ...
 => CACHED [stage-3 5/7] COPY . .                                                                                                                                                                          0.0s
 => ERROR [stage-3 6/7] RUN chmod +x /app/bin/*                                  0.3s
------
 > [stage-3 6/7] RUN chmod +x /app/bin/* 
#19 0.262 chmod: cannot access '/app/bin/*': No such file or directory

Good point. I just realized that this app was upgraded to Rails 4.2.x from Rails 3.x and the bin folder was introduced after v4.

Ran rake rails:update:bin to create bin folder and the deploy command works fine. Thanks.