获取 "Could not locate Gemfile" 在 docker 中安装 Redmine 插件

Getting "Could not locate Gemfile" installing a Redmine plugin in docker

尝试在 redmine 中安装插件,使用 docker。我是 redmine 的新手,只知道 docker 基础知识。我不了解 Ruby,所以我知道这些 Gemfiles 安装是如何工作的。

我正在尝试安装 Issue recurring。该插件的安装说明看起来很简单:

su - redmine
git -C /var/lib/redmine/plugins/ clone https://github.com/cryptogopher/issue_recurring.git
cd /var/lib/redmine
bundle install
RAILS_ENV=production rake redmine:plugins:migrate

所以我尝试将其转换为 Dockerfile:

FROM redmine:3.3
RUN mkdir -p /var/lib/redmine/plugins/
RUN chown -R redmine:redmine /var/lib/redmine
#su - redmine
USER redmine
RUN git -C /var/lib/redmine/plugins/ clone https://github.com/cryptogopher/issue_recurring.git
#cd /var/lib/redmine
WORKDIR /var/lib/redmine/
#bundle install
RUN bundle install
#RAILS_ENV=production rake redmine:plugins:migrate
ENV RAILS_ENV production
RUN rake redmine:plugins:migrate

但我得到的是:

...
Step 7/9 : RUN bundle install
 ---> Running in 1139cd4ccb43
Could not locate Gemfile
The command '/bin/sh -c bundle install' returned a non-zero code: 10

是我哪里做错了,还是插件有bug?由于在 Ruby 方面缺乏经验,我无法判断。我也在“/var/lib/redmine/plugins/”和“/var/lib/redmine/plugins/issue-recurring/”中尝试了 运行 "bundle install",但结果相同。

插件的安装说明似乎适用于非docker场景。尝试 "redmine bundle install" 就像他们在这里做的那样: https://github.com/docker-library/redmine/blob/master/3.3/Dockerfile#L129

任何寻求解决方案的人,都在这里:https://it.michalczyk.pro/issues/15

摘录:

I found the problem. It's not installed under /var/lib/redmine/, it's installed under "/usr/src/redmine"! I was assuming /var/lib/redmine/ is the standard directory...