我正在尝试使用Docker运行Rails应用程序。以下是通过Github的ssh URL安装的几个gems:
Gemfile
gem 'swagger-docs', :git => 'git@github.com:xyz/swagger-docs.git', :branch => 'my_branch'
我已经在Dockerfile中添加了keys
,这可以克隆所需的仓库并从Git安装gems。
Dockerfile
RUN mkdir -p /root/.ssh
COPY ./id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN ssh-keygen -f /root/.ssh/id_rsa -y > /root/.ssh/id_rsa.pub
RUN ssh-keyscan github.com >> /root/.ssh/known_hosts
我构建it时(包括bundle install
),一切顺利,镜像也被成功构建。但是当我运行docker-compose up
时,会出现以下错误:
/usr/local/bundle/gems/bundler-1.9.2/lib/bundler/source/git/git_proxy.rb:155:in `allowed_in_path': The git source git@github.com:xyz/swagger-docs.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError)