`
gogo1217
  • 浏览: 152314 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Docker redmine 安装 redmine_ckeditor 插件失败解决办法

 
阅读更多

在 Redmine Docker 容器中安装 redmine_ckeditor ,按照官方的步骤进行安装,报错,不成功。
1、 从官网 https://github.com/a-ono/redmine_ckeditor/archive/master.zip 下载zip包。

2、解压并修改文件名:

 

    $ unzip master.zip 
    $ mv redmine_ckeditor-master redmine_ckeditor


3、将文件拷贝至 redmine 容器中的 plugins 目录(一般通过卷映射)

4、进入容器

    $ docker exec -it redmine bash

 

5、安装 gem 依赖(#表示在容器中)

    # bundle install --without development test


很遗憾,出现以下错误。
Fetching ffi 1.9.25
Installing ffi 1.9.25 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/ffi-1.9.25/ext/ffi_c
/usr/local/bin/ruby -r ./siteconf20180831-58-8nh962.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
 .....

An error occurred while installing ffi (1.9.25), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.25' --source 'https://rubygems.org/'` succeeds before bundling.
(安装前,确保 `gem install ffi -v '1.9.25' --source 'https://rubygems.org/' ` 能安装成功。

6、执行 ffi 安装命令
 

   # gem install ffi -v '1.9.25' --source 'https://rubygems.org/'

 

继续遗憾,出现以下错误:
Building native extensions. This could take a while...
ERROR:  Error installing ffi:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/ffi-1.9.25/ext/ffi_c
/usr/local/bin/ruby -r ./siteconf20180831-162-z2gnup.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

原因分析:
其实这是因为 Redmine 的 docker 镜像 缺少 ffi 安装必要的编译环境,从而导致失败,需要我们手动安装下。安装步骤如下:

 


1、先更新下源,否则会报下面的错误。(请注意,这是在容器中执行)。

    # apt update

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby-dev

 

更新完毕后,我们安装依赖

    # apt-get install gcc ruby-dev make
    # gem install ffi -v '1.9.25' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed ffi-1.9.25
1 gem installed

 
至此,我们可以按照官方网站进行后续安装了。

    # bundle install --without development test
    # rake redmine:plugins:migrate RAILS_ENV=production

 
8、重启 Redmine

 

 

自定义镜像:
上述办法存在一定的局限性,只在当前容器有效,当我们容器重新创建的时候,又的重新来一次,非常麻烦。比较好的办法,是自定义镜像。
创建 Dockerfile 文件内容如下:

From redmine:latest
RUN apt update  \
&& apt-get -y --force-yes  install gcc ruby-dev make \
&& gem install ffi -v '1.9.25' --source 'https://rubygems.org/'

 
构建镜像

docker build -t redmine-gogo .

 
后面使用 自定义镜像 redmine-gogo,即可。

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics