dawarich icon indicating copy to clipboard operation
dawarich copied to clipboard

Unable to build using Docker.prod file due to Missing secret_key_base

Open chrisl8 opened this issue 1 month ago • 2 comments

Sorry this is going to be just a dump of an error without much explanation.

This is what I'm getting when trying to build:

------
 > [dawarich_app  8/12] RUN bundle exec rake assets:precompile     && rm -rf node_modules tmp/cache:
3.836 rake aborted!
3.839 ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `bin/rails credentials:edit` (ArgumentError)
3.839
3.839           raise ArgumentError, "Missing `secret_key_base` for '#{Rails.env}' environment, set this string with `bin/rails credentials:edit`"
3.839                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/application/configuration.rb:522:in `secret_key_base='
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/application/configuration.rb:506:in `secret_key_base'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/devise-4.9.4/lib/devise/secret_key_finder.rb:24:in `key_exists?'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/devise-4.9.4/lib/devise/secret_key_finder.rb:14:in `find'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/devise-4.9.4/lib/devise/rails.rb:41:in `block in <class:Engine>'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/initializable.rb:32:in `instance_exec'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/initializable.rb:32:in `run'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/initializable.rb:60:in `run_initializers'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/application.rb:440:in `initialize!'
3.839 /var/app/config/environment.rb:7:in `<main>'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/zeitwerk-2.7.1/lib/zeitwerk/core_ext/kernel.rb:34:in `require'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/application.rb:416:in `require_environment!'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/railties-8.0.1/lib/rails/application.rb:564:in `block in run_tasks_blocks'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/sprockets-rails-3.5.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
3.839 /var/app/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli/exec.rb:58:in `load'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli/exec.rb:58:in `kernel_load'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli/exec.rb:23:in `run'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli.rb:455:in `exec'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli.rb:35:in `dispatch'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/cli.rb:29:in `start'
3.839 /usr/local/bundle/gems/bundler-2.5.21/exe/bundle:28:in `block in <top (required)>'
3.839 /usr/local/bundle/gems/bundler-2.5.21/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
3.839 /usr/local/bundle/gems/bundler-2.5.21/exe/bundle:20:in `<top (required)>'
3.839 /usr/local/bundle/bin/bundle:25:in `load'
3.839 /usr/local/bundle/bin/bundle:25:in `<main>'
[+] Building 1/2 => environment
 ✔ Service dawarich_photon  Built                                                                                                                                  1.1s
 ⠏ Service dawarich_app     Building                                                                                                                               4.9s
failed to solve: process "/bin/sh -c bundle exec rake assets:precompile     && rm -rf node_modules tmp/cache" did not complete successfully: exit code: 1

I know the SECRET_KEY_BASE is set in the compose file, but maybe this is required to be in the Dockerfile itself?

I'm not sure if I messed something up or if something else needs to be added to the Dockerfile?

chrisl8 avatar Jan 09 '25 17:01 chrisl8