我已经使用alpine-3.7和ruby-2.5(bundler-2.1.2)创建了一个docker镜像。使用bundle install
安装红宝石宝石时,出现以下错误。
Fetching jaro_winkler 1.5.2
Installing jaro_winkler 1.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
An error occurred while installing jaro_winkler (1.5.2), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.2' --source 'https://cernerrepos.net/api/gems/rubygems/'` succeeds before bundling
将RUN apk update && apk add --virtual build-dependencies build-base
添加到docker文件,然后运行bundle install
解决了该问题。
# below line is just an example, and it might not work for you, use the correct repo name and image name
FROM docker.repos.net/ruby:2.5-alpine3.7
RUN apk add --no-cache bash
RUN /bin/sh
RUN apk update && apk add --virtual build-dependencies build-base
RUN gem install bundler
RUN bundle install