Ruby runtime with Nokogiri
1.7K
Ruby runtime with Nokogiri
Actually, Nokogiri is not yet installed. Is means you can install any version of Nokogiri but need to compile it in this docker image. So I recommend you to use volume option of docker run and path option of bundle install to cache gems in your local storage.
Gemfile and Rakefile are existing in current dir.
$ ls
Gemfile Rakefile
Install Nokogiri which is defined in Gemfile. And then execute rake command to run some task.
#!/usr/bin/env bash
__run_rake() {
local docker_image="takitake/rubyalpine-nokogiri"
local host_src_volume="${PWD}"
local container_dest_volume="/work"
docker run \
--volume="${host_src_volume}:${container_dest_volume}" \
--workdir="${container_dest_volume}" \
--user="${UID}:${GID}" \
--rm \
"${docker_image}" sh -c "
mkdir -p .bundle &&
echo 'BUNDLE_BUILD__NOKOGIRI: --use-system-libraries' | tee .bundle/config &&
bundle install --path .bundle &&
bundle exec rake $@"
}
__run_rake $@
To use libraries which are installed system wide already set configuration.
mkdir -p .bundle &&
echo 'BUNDLE_BUILD__NOKOGIRI: --use-system-libraries' | tee .bundle/config
--local option doesn't work expectedly..
bundle config --local build.nokogiri --use-system-libraries
Ruby gems will be installed in .bundle dir with following setting to cache.
bundle install --path .bundle
Content type
Image
Digest
Size
93.1 MB
Last updated
over 7 years ago
docker pull takitake/rubyalpine-nokogiri