gpt4 book ai didi

ruby-on-rails - Rails docker应用程序捆绑 rake 被中止

转载 作者:行者123 更新时间:2023-12-02 20:15:27 30 4
gpt4 key购买 nike

我正在尝试使用docker创建一个Rails应用,并且在我的初始docker build期间遇到错误。我一直在遵循各种教程来尝试使它起作用,但没有任何运气。

我的错误:

Step 10/12 : RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/neo SECRET_TOKEN=foobar assets:precompile
---> Running in d3d282e3eb8b
/usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
rake aborted!
NoMethodError: undefined method `split' for nil:NilClass
/app/config/application.rb:57:in `<class:Application>'
/app/config/application.rb:10:in `<module:NeoDocker>'
/app/config/application.rb:9:in `<top (required)>'
/app/Rakefile:5:in `require_relative'
/app/Rakefile:5:in `<top (required)>'
/usr/local/bundle/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
The command '/bin/sh -c bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/neo SECRET_TOKEN=foobar assets:precompile' returned a non-zero code: 1

Dockerfile:
FROM ruby:2.4.1
RUN apt-get update && apt-get install -qq -y --no-install-recommends \
build-essential nodejs libpq-dev
ENV INSTALL_PATH /app
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY Gemfile Gemfile.lock ./
RUN bundle install --binstubs
COPY . .
RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/neo SECRET_TOKEN=foobar assets:precompile
VOLUME ["$INSTALL_PATH/public"]
CMD puma -C config/puma.rb

我的Gemfile现在几乎是Rails 5的默认设置:
source 'https://rubygems.org'
gem 'rails', '~> 5.0.1'
gem 'puma', '~> 3.0'
gem 'rack-timeout', '~> 0.4'
gem 'jbuilder', '~> 2.5'
gem 'pg', '~> 0.18'
gem 'redis-rails', '~> 5.0.0.pre'
gem 'sidekiq', '~> 4.2'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'bootstrap-sass', '~> 3.3'
gem 'font-awesome-rails', '~> 4.7'
group :development, :test do
gem 'byebug', platform: :mri
end

group :development do
gem 'rack-mini-profiler', '~> 0.10'
gem 'web-console', '~> 3.3.0'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

怎么了

最佳答案

我认为您可以解决问题,但也许答案可以帮助某人

您可以尝试解决在Gemfile中更新Rails的警告,更改为:

gem 'rails', '~> 5.0.1'

通过
gem 'rails', '~> 5.0.2'

然后执行 bundle update rails(我不知道在Docker中是否必要)

另外,也许您在第57行的 /app/config/application.rb文件中可能有错误

关于ruby-on-rails - Rails docker应用程序捆绑 rake 被中止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43743153/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com