在高山docker映像上安装docx_converter gem

时间:2020-08-10 08:58:39

标签: ruby linux docker rubygems

我想尝试docx_converter,但在安装红宝石高山docker映像时遇到了麻烦,

到目前为止,这是我的dockerfile,(不起作用)。

FROM ruby:2.6-alpine

RUN apk add --update \
  libmagickwand-dev \
  pkgconfig imagemagick imagemagick-dev imagemagick-libs

RUN gem install docx_converter

它抱怨libmagickwand-dev在apk仓库中不存在。

如果我从安装中删除该库,则gem install docx_converter会因缺少库而失败(如预期)

麻烦的库失败似乎是ruby-filemagic-0.7.2,

带有此日志文件(cat /usr/local/bundle/extensions/x86_64-linux/2.6.0/ruby-filemagic-0.7.2/mkmf.log

"gcc -o conftest -I/usr/local/include/ruby-2.6.0/x86_64-linux-musl -I/usr/local/include/ruby-2.6.0/ruby/backward -I/usr/local/include/ruby-2.6.0 -I. -I/opt/local/include -I/usr/local/include -I/usr/include    -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable  -fPIC conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L/opt/local/lib -Wl,-rpath,/opt/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L/usr/lib -Wl,-rpath,/usr/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

我尝试使用以下dockerfile单独安装ruby-filemagic

FROM ruby:2.6-alpine

RUN apk add --update \
  pkgconfig imagemagick imagemagick-dev imagemagick-libs \
  musl libmagic file file-dev

RUN gem install ruby-filemagic

RUN gem install docx_converter

并出现制作错误

current directory: /usr/local/bundle/gems/ruby-filemagic-0.7.2/ext/filemagic
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.6.0 -r ./siteconf20200810-1-s6d76t.rb extconf.rb
checking for -lgnurx... *** extconf.rb failed ***

关于如何运行它的任何想法?

谢谢, G

1 个答案:

答案 0 :(得分:0)

通过将以下库添加到我的dockerfile中,我设法安装了ruby-filemagic

RUN apk add --update \
  build-base

build-base包含gnurx