Docker + rails 4:奇怪的错误:运行bundle exec rake资源:预编译
尝试使用Docker部署rails4应用程序,我在下面的Dockerfile中:
FROM ubuntu:14.04 RUN apt-get update && \ apt-get install -qy software-properties-common RUN apt-add-repository -y ppa:brightbox/ruby-ng RUN apt-get update && apt-get upgrade -y # Ruby and dependencies RUN apt-get install -qy curl nodejs libmysqlclient-dev libsqlite3-dev libpq-dev build-essential \ ruby2.2 ruby2.2-dev RUN gem install bundler --no-ri --no-rdoc # Cache bundle install WORKDIR /tmp ADD Gemfile Gemfile ADD Gemfile.lock Gemfile.lock RUN bundle install --without development test # Add rails project to project directory ADD ./ /rails # set WORKDIR WORKDIR /rails RUN bundle exec rake assets:precompile # Cleanup RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Publish port 8080 EXPOSE 8080
在我的docker-compose.ml中,我们的服务被定义为使用这个Dockerfile来构build它
.... web: build: . ....
但是构build失败:
service 'web' failed to build: The command '/bin/sh -c bundle exec rake assets:precompile' returned a non-zero code: 1
根据控制台,错误是:
---> Running in 32c12f52e507 /var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find debug_inspector-0.0.2 in any of the sources (Bundler::GemNotFound)
我在Gemfile中添加了gem,
gem 'debug_inspector', '~> 0.0.2'
我捆绑和重build..,现在另一个错误提出了另一个失踪的gem:
var/lib/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find binding_of_caller-0.7.2 in any of the sources (Bundler::GemNotFound)
我不明白发生了什么事情..我忘记了什么,以避免这样的重复错误?
感谢帮助
我改变了我的Dockerfle
RUN bundle install --without development test
至
RUN bundle install
这些gem是开发环境所需要的…