ruby - 带有 C 扩展的 Ruby gem 不在 Ubuntu 中构建
问题描述
我正在尝试基于Dockerfile
Heroku 的新heroku/heroku:18
映像(使用 Ubuntu 18.04)并遇到一些我在他们非常旧的heroku/cedar:14
基本映像中没有的问题,我相信由于他们有不同的预安装包。(我将基础映像更新为heroku/heroku:18
因为我想使用webpacker
gem,并且在 Cedar-14 中我得到了:Webpacker requires Node.js >= 6.0.0 and you are using 0.10.25
。如果有一种简单的方法可以在旧的基础映像中安装更新的节点,我很乐意听到它!)
我的问题是没有任何带有 C 扩展名的 gem(如puma
, pg
, msgpack
, 等)使用这个新的基础 Docker 映像成功安装。错误消息因宝石而异,但通常都说:
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
有类似问题的各种 GitHub 问题让我尝试过:
apt-get install
:build-essential
libpq-dev
libssl-dev
openssl
libssl1.0-dev
gcc
gcc-5
automake
make
- 使用
heroku/heroku:18-build
代替heroku/heroku:18
这些解决方案都不能解决问题。
作为参考,这里是我的相关部分Dockerfile
:
FROM heroku/heroku:18
RUN apt-get update && apt-get install -y nodejs --no-recommends
RUN (mkdir -p /ruby && cd /ruby && curl https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.0.tgz -s -o - | tar xzf - --no-same-owner)
ENV GEM_HOME=/ruby/gems GEM_PATH=/ruby/gems
RUN gem install bundler
RUN bundle install
解决方案
推荐阅读
- php - 使用 AJAX 在 HTML 页面中获取 XML 数据
- powerbi - Power BI 在同一行显示标题和值
- python - 试图理解使用 inplace = true vs false 更改列名
- c++ - 使用c ++连续将数据从服务器发送到接收器
- python - 使用 matplotlib/seaborn 从 pivot_table 绘制 sub_plots
- spring - 在 Spring 执行器中:HealthEndPoint.health() 是否给出与调用 /health 端点相同的结果?
- java - 解析时获取 com.fasterxml.jackson.core.JsonParseException
- jenkins - 在 Jenkins 的 JMeter 负载测试期间获取服务器的 CPU 和内存使用情况图
- css - Css 网格重复语法
- c - 相同大小的 server.key.der 或 server.crt.der