停靠现有rails应用程序

ndh0cuux  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(202)

我一直在尝试将我的rails应用程序移动到docker容器中,因为它过去是在dev env的virtualbox中管理的。我已经看过一些docker教程和一些特定于迁移rails应用程序的教程,但我遇到了以下错误:

=> 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>'

下面是我试图通过docker compose运行的简化dockerfile。我最初将它连接到mysql映像,但为了帮助调试,已将其删除,但错误仍然存在。
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

Docker公司

version: "3.7"

services:
  api:
    image: my_api
    build:
      context: ./
      dockerfile: ./docker/app/dockerfile
    ports: 
      - 3000:3000
    working_dir: /api

我在下面的so线程中尝试了一些解决方案,但似乎没有什么能消除错误:在运行bundle install之前指定供应商/缓存的路径并安装rake

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题