gpt4 book ai didi

ruby - 如何将jekyll安装到Docker镜像?

转载 作者:行者123 更新时间:2023-12-02 19:11:00 24 4
gpt4 key购买 nike

我想生成一个具有jekyll命令可用的docker镜像。

我生成了一个带有以下内容的Dockerfile:

# https://hub.docker.com/_/ruby/
FROM ruby:slim

RUN gem install jekyll

不幸地抛出一个错误:
ERROR:  Error installing jekyll:
ERROR: Failed to build gem native extension.

current directory: /usr/local/bundle/gems/ffi-1.9.10/ext/ffi_c
/usr/local/bin/ruby -r ./siteconf20160615-7-12pthrg.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.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /usr/local/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
from extconf.rb:16:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/local/bundle/extensions/x86_64-linux/2.3.0-static/ffi-1.9.10/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/ffi-1.9.10 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.3.0-static/ffi-1.9.10/gem_make.out

我在做什么错?

最佳答案

要诊断问题,您可以跳入容器并深入研究导致问题的原因。

$ docker run -ti --rm ruby:slim /bin/bash
root@bda37983a585:/# gem install jekyll
# ...

另外,总会有jekyll docker镜像:
https://hub.docker.com/u/jekyll/

祝好运!

关于ruby - 如何将jekyll安装到Docker镜像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37832802/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com