I've been trying to move my rails app into a docker container, as it used to be ansible managed in a virtualbox for dev env. I've looked at a few docker tutorials and a couple specific to migrating rails applications but I am running into the following error:
=> ERROR [10/10] RUN rails c 0.9s
------
> [10/10] RUN rails c:
#15 0.878 /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find rake-13.0.1 in any of the sources (Bundler::GemNotFound)
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/spec_set.rb:85:in `map!'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/spec_set.rb:85:in `materialize'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/definition.rb:170:in `specs'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/definition.rb:237:in `specs_for'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/definition.rb:226:in `requested_specs'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/runtime.rb:108:in `block in definition_method'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/runtime.rb:20:in `setup'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler.rb:107:in `setup'
#15 0.879 from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/setup.rb:20:in `<top (required)>'
#15 0.879 from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
#15 0.879 from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
#15 0.879 from /usr/local/bundle/bin/rails:27:in `<main>'
Here is the simplified dockerfile I am trying to run via docker-compose. I originally had it connected to my MySQL image but have removed that to help debug, however the error still persists.
Dockerfile
FROM ruby:2.4.0
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
build-essential \
mysql-client \
nodejs \
supervisor \
&& apt-get clean -q clean \
&& rm -rf /var/lib/apt/lists
RUN mkdir -p /my_api
ENV RAILS_ROOT /my_api
WORKDIR $RAILS_ROOT
COPY ../../Gemfile ./
RUN gem install bundler --no-ri --no-rdoc --version 1.17.3
RUN bundle install
COPY . ./
RUN gem list
RUN rails c
DockerCompose
version: "3.7"
services:
api:
image: my_api
build:
context: ./
dockerfile: ./docker/app/dockerfile
ports:
- 3000:3000
working_dir: /api
I've tried a few solutions in the following SO threads but nothing seems to remove the error: Specifying path to vendor/cache and installing rake before running bundle install