Gems not found during fly:release

During fly deploy the build seems to succeed but starting the app fails with this error:

2022-11-14T15:32:24Z app[c936e9df] dfw [info]Starting init (commit: 81d5330)...
2022-11-14T15:32:24Z app[c936e9df] dfw [info]Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
2022-11-14T15:32:24Z app[c936e9df] dfw [info]no label, UUID=d08674fa-12aa-488a-93e7-7b075cd6a6be
2022-11-14T15:32:25Z app[c936e9df] dfw [info]Preparing to run: `bin/rails fly:release` as root
2022-11-14T15:32:25Z app[c936e9df] dfw [info]2022/11/14 15:32:25 listening on [fdaa:0:dcb9:a7b:cf99:c936:e9df:2]:22 (DNS: [fdaa::3]:53)
2022-11-14T15:32:25Z app[c936e9df] dfw [info]/usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:507:in `materialize': Could not find rails-5.2.8.1, puma-3.12.6, sass-rails-5.1.0, uglifier-4.2.0, coffee-rails-4.2.2, turbolinks-5.2.1, jbuilder-2.11.5, pg-0.21.0, thin-1.8.1, devise-4.8.1, omniauth-facebook-9.0.0, omniauth-google-oauth2-1.1.1, omniauth-twitter-1.4.0, actioncable-5.2.8.1, actionmailer-5.2.8.1, actionpack-5.2.8.1, actionview-5.2.8.1, activejob-5.2.8.1, activemodel-5.2.8.1, activerecord-5.2.8.1, activestorage-5.2.8.1, activesupport-5.2.8.1, railties-5.2.8.1, sprockets-rails-3.4.2, sass-3.7.4, sprockets-3.7.2, tilt-2.0.11, execjs-2.8.1, coffee-script-2.4.1, turbolinks-source-5.2.0, daemons-1.4.1, eventmachine-1.2.7, rack-2.2.4, bcrypt-3.1.18, orm_adapter-0.5.0, responders-3.0.1, warden-1.2.9, omniauth-oauth2-1.8.0, jwt-2.5.0, oauth2-2.0.9, omniauth-2.1.0, omniauth-oauth-1.2.0, nio4r-2.5.8, websocket-driver-0.7.5, mail-2.7.1, rails-dom-testing-2.0.3, rack-test-2.0.2, rails-html-sanitizer-1.4.3, builder-3.2.4, erubi-1.11.0, globalid-1.0.0, arel-9.0.0, marcel-1.0.2, concurrent-ruby-1.1.10, i18n-1.12.0, minitest-5.16.3, tzinfo-1.2.10, method_source-1.0.0, rake-13.0.6, thor-1.2.1, sass-listen-4.0.0, coffee-script-source-1.12.2, faraday-2.6.0, multi_xml-0.6.0, snaky_hash-2.0.1, version_gem-1.1.1, hashie-5.0.0, rack-protection-3.0.3, oauth-1.1.0, websocket-extensions-0.1.5, mini_mime-1.1.2, nokogiri-1.13.9, loofah-2.19.0, thread_safe-0.3.6, rb-fsevent-0.11.2, rb-inotify-0.10.1, faraday-net_http-3.0.2, ruby2_keywords-0.0.5, oauth-tty-1.0.5, mini_portile2-2.8.0, racc-1.6.0, crass-1.0.6, ffi-1.15.5 in locally installed gems (Bundler::GemNotFound)
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:187:in `specs'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:244:in `specs_for'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:18:in `setup'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler.rb:161:in `setup'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in
`require'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /usr/lib/fullstaq-ruby/versions/2.7.1-jemalloc/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from /app/config/boot.rb:3:in `<top (required)>'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from bin/rails:4:in `require_relative'
2022-11-14T15:32:25Z app[c936e9df] dfw [info]	from bin/rails:4:in `<main>'
2022-11-14T15:32:26Z app[c936e9df] dfw [info]Starting clean up.

Dockerfile:

# syntax = docker/dockerfile:experimental

# Dockerfile used to build a deployable image for a Rails application.
# Adjust as required.
#
# Common adjustments you may need to make over time:
#  * Modify version numbers for Ruby, Bundler, and other products.
#  * Add library packages needed at build time for your gems, node modules.
#  * Add deployment packages needed by your application
#  * Add (often fake) secrets needed to compile your assets

#######################################################################

# Learn more about the chosen Ruby stack, Fullstaq Ruby, here:
#   https://github.com/evilmartians/fullstaq-ruby-docker.
#
# We recommend using the highest patch level for better security and
# performance.

ARG RUBY_VERSION=2.7.1
ARG VARIANT=jemalloc-slim
FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base

LABEL fly_launch_runtime="rails"

ARG BUNDLER_VERSION=2.0.2

ARG RAILS_ENV=production
ENV RAILS_ENV=${RAILS_ENV}

ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_LOG_TO_STDOUT true

ARG BUNDLE_WITHOUT=development:test
ARG BUNDLE_PATH=vendor/bundle
ENV BUNDLE_PATH ${BUNDLE_PATH}
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}

RUN mkdir /app
WORKDIR /app
RUN mkdir -p tmp/pids

RUN gem update --system --no-document && \
    gem install -N bundler -v ${BUNDLER_VERSION}

#######################################################################

# install packages only needed at build time

FROM base as build_deps

ARG BUILD_PACKAGES="git build-essential libpq-dev wget vim curl gzip xz-utils libsqlite3-dev"
ENV BUILD_PACKAGES ${BUILD_PACKAGES}

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 && \
    apt-get install --no-install-recommends -y ${BUILD_PACKAGES} \
    && rm -rf /var/lib/apt/lists /var/cache/apt/archives

#######################################################################

# install gems

FROM build_deps as gems

COPY Gemfile* ./
RUN bundle install &&  rm -rf vendor/bundle/ruby/*/cache

#######################################################################

# install deployment packages

FROM base

ARG DEPLOY_PACKAGES="postgresql-client file vim curl gzip libsqlite3-0 nodejs"
ENV DEPLOY_PACKAGES=${DEPLOY_PACKAGES}

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 && \
    apt-get install --no-install-recommends -y \
    ${DEPLOY_PACKAGES} \
    && rm -rf /var/lib/apt/lists /var/cache/apt/archives

# copy installed gems
COPY --from=gems /app /app
COPY --from=gems /usr/lib/fullstaq-ruby/versions /usr/lib/fullstaq-ruby/versions
COPY --from=gems /usr/local/bundle /usr/local/bundle

#######################################################################

# Deploy your application
COPY . .

# Adjust binstubs to run on Linux and set current working directory
RUN chmod +x /app/bin/* && \
    sed -i 's/ruby.exe/ruby/' /app/bin/* && \
    sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*

# The following enable assets to precompile on the build server.  Adjust
# as necessary.  If no combination works for you, see:
# https://fly.io/docs/rails/getting-started/existing/#access-to-environment-variables-at-build-time
ENV SECRET_KEY_BASE 1
# ENV AWS_ACCESS_KEY_ID=1
# ENV AWS_SECRET_ACCESS_KEY=1

# Run build task defined in lib/tasks/fly.rake
ARG BUILD_COMMAND="bin/rails fly:build"
RUN ${BUILD_COMMAND}

# Default server start instructions.  Generally Overridden by fly.toml.
ENV PORT 8080
ARG SERVER_COMMAND="bin/rails fly:server"
ENV SERVER_COMMAND ${SERVER_COMMAND}
CMD ${SERVER_COMMAND}