Ich bin neu in Docker. Ich habe eine bestehende Rails App und möchte diese docken. Bitte hilf mir, wie kann ich das lösen? Ich bin auf dieses Problem gestoßen. Ich habe den Fehler gepostet, wenn ich dies ausführe.Konnte nicht gefunden werden Ketten-3.6.2 in einer der Quellen (Bundler :: GemNotFound) beim Ausführen von Docker-komponieren
redis_1 | 1:M 03 Jul 11:47:39.087 * The server is now ready to accept connections on port 6379
sidekiq_1 | /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find sprockets-3.6.2 in any of the sources (Bundler::GemNotFound)
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
sidekiq_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<top (required)>'
sidekiq_1 | from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
sidekiq_1 | from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
backend_1 | /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find sprockets-3.6.2 in any of the sources (Bundler::GemNotFound)
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
backend_1 | from /usr/local/bundle/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<top (required)>'
backend_1 | from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
backend_1 | from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
backend_sidekiq_1 exited with code 1
backend_backend_1 exited with code 1
Das ist mein Gemfile
:
source 'https://rubygems.org'
gem 'unicorn', '~> 4.9'
gem 'pg', '~> 0.18.3'
gem 'sidekiq', '~> 4.0.1'
gem 'redis-rails', '~> 4.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Als ich den Build-Prozess gestartet, sprockets-3.6.2
installiert wurde.
Mein Dockerfile
:
# Use the barebones version of Ruby 2.2.3.
FROM ruby:2.2.3-slim
# Optionally set a maintainer name to let people know who made this image.
MAINTAINER Class and Objects <[email protected]>
# Install dependencies:
RUN apt-get update && apt-get install -qq -y build-essential nodejs libpq-dev postgresql-client-9.4 --fix-missing --no-install-recommends
# Set an environment variable to store where the app is installed to inside
# of the Docker image.
# CHANGE ALL INSTANCE OF 'backend' WITH YOUR PROJECT NAME
ENV INSTALL_PATH /backend
RUN mkdir -p $INSTALL_PATH
# This sets the context of where commands will be ran in and is documented
# on Docker's website extensively.
WORKDIR $INSTALL_PATH
# Ensure gems are cached and only get updated when they change. This will
# drastically increase build times when your gems do not change.
COPY Gemfile Gemfile
RUN bundle install
# Copy in the application code from your work station at the current directory
# over to the working directory.
COPY . .
# Provide dummy data to Rails so it can pre-compile assets.
RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:[email protected]/dbname SECRET_TOKEN=pickasecuretoken
#assets:precompile
# Expose a volume so that nginx will be able to read in assets in production.
VOLUME ["$INSTALL_PATH/public"]
# The default command that gets ran will be to start the Unicorn server.
CMD bundle exec unicorn -c config/unicorn.rb
Mein docker-compose.yml
:
postgres:
image: postgres:9.4.5
environment:
POSTGRES_USER: backend
POSTGRES_PASSWORD: yourpassword
ports:
- '5432:5432'
volumes:
- backend-postgres:/var/lib/postgresql/data
redis:
image: redis:3.0.5
ports:
- '6379:6379'
volumes:
- backend-redis:/var/lib/redis/data
backend:
build: .
links:
- postgres
- redis
volumes:
- .:/backend
ports:
- '8000:8000'
env_file:
- .backend.env
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
links:
- postgres
- redis
volumes:
- .:/backend
env_file:
- .backend.env
mein sidekiq.rb
:
sidekiq_config = { url: ENV['JOB_WORKER_URL'] }
Sidekiq.configure_server do |config|
config.redis = sidekiq_config
end
Sidekiq.configure_client do |config|
config.redis = sidekiq_config
end
Die Dockerfile für sidekiq und Backend würde helfen, und Ihr docker-compose.yml. – BMitch
@BMitch hat diese Dateien hinzugefügt. – aks