My rails 7.1.x app deploys just fine. But when I want to do the update to 7.2.x it always fails on the RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
step with the following error.
=> ERROR [build 11/11] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile 2.2s
------
> [build 11/11] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile:
2.168 bin/rails aborted!
2.169 NoMethodError: undefined method `to_sym' for nil (NoMethodError)
2.169
2.169 super(key.to_sym)
2.169 ^^^^^^^
2.170 /usr/local/bundle/ruby/3.3.0/gems/activesupport-7.2.1/lib/active_support/ordered_options.rb:42:in `[]'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations/connection_url_resolver.rb:84:in `resolved_adapter'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations/connection_url_resolver.rb:28:in `initialize'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations/url_config.rb:73:in `new'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations/url_config.rb:73:in `build_url_hash'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations/url_config.rb:44:in `initialize'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:67:in `new'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:67:in `block in <class:DatabaseConfigurations>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:279:in `block in build_db_config_from_hash'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:278:in `reverse_each'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:278:in `build_db_config_from_hash'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:257:in `build_db_config_from_raw_config'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:208:in `block in build_configs'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:204:in `each'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:204:in `flat_map'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:204:in `build_configs'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/database_configurations.rb:74:in `initialize'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/tasks/database_tasks.rb:144:in `new'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/tasks/database_tasks.rb:144:in `for_each'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/railties/databases.rake:35:in `block (2 levels) in <main>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/railties/databases.rake:30:in `block in <main>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/railties/databases.rake:9:in `<main>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/railtie.rb:57:in `load'
2.170 /usr/local/bundle/ruby/3.3.0/gems/activerecord-7.2.1/lib/active_record/railtie.rb:57:in `block in <class:Railtie>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/railtie.rb:285:in `instance_exec'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/railtie.rb:285:in `block in run_tasks_blocks'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/railtie.rb:297:in `each'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/railtie.rb:297:in `each_registered_block'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/railtie.rb:285:in `run_tasks_blocks'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/application.rb:553:in `block in run_tasks_blocks'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/engine/railties.rb:15:in `each'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/engine/railties.rb:15:in `each'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/application.rb:553:in `run_tasks_blocks'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/engine.rb:470:in `load_tasks'
2.170 /rails/Rakefile:8:in `<main>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:43:in `block in with_rake'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:41:in `with_rake'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:156:in `invoke_rake'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:73:in `block in invoke'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:149:in `with_argv'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/command.rb:69:in `invoke'
2.170 /usr/local/bundle/ruby/3.3.0/gems/railties-7.2.1/lib/rails/commands.rb:18:in `<main>'
2.170 /usr/local/bundle/ruby/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
2.170 ./bin/rails:5:in `<main>'
2.170 (See full trace by running task with --trace)
NOTE When running this precompile locally there are no issues at all.
The full dockerfile for fly.io is:
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.5
FROM ruby:$RUBY_VERSION-slim AS base
LABEL fly-launch-runtime="rails"
# Rails app lives here
WORKDIR /rails
# Set production environment
ENV BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development:test" \
RAILS_ENV="production"
# Update gems and bundler
# skipcq: DOK-DL3028
RUN gem update --system --no-document && \
gem install -N bundler
# Throw-away build stage to reduce size of final image
FROM base AS build
# Install packages needed to build gems and node modules
# skipcq: DOK-DL3008
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3
# Install JavaScript dependencies
ARG NODE_VERSION=22.9.0
ARG YARN_VERSION=4.3.1
ENV PATH=/usr/local/node/bin:$PATH
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
corepack enable && \
corepack prepare yarn@$YARN_VERSION --activate && \
rm -rf /tmp/node-build-master
# Install node modules
COPY .yarn ./.yarn
COPY --link package.json yarn.lock .yarnrc.yml ./
RUN yarn install --immutable
# Install application gems
COPY --link Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
# Copy application code
COPY --link . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Adjust binfiles to set current working directory
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN grep -l '#!/usr/bin/env ruby' /rails/bin/* | xargs sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)'
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image
FROM base
# Install packages needed for deployment
# skipcq: DOK-DL3008
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl imagemagick libvips postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Copy built artifacts: gems, application
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails
# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
chown -R 1000:1000 db log storage tmp
USER 1000:1000
# Entrypoint sets up the container.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
Has anyone seen this before? Any idea as to why this is happening?