Sign inSign up

takitake/rubyalpine-nokogiri

By takitake

•Updated over 7 years ago

Ruby runtime with Nokogiri

Image
0

1.7K

takitake/rubyalpine-nokogiri repository overview

⁠docker-rubyalpine-nokogiri

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.

⁠Sample Usage

⁠Prerequisite

Gemfile and Rakefile are existing in current dir.

$ ls
Gemfile Rakefile
⁠Make wrapper script

Install Nokogiri which is defined in Gemfile. And then execute rake command to run some task.

⁠Wrapper Script
#!/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 $@
⁠Exposition

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

Tag summary

Content type

Image

Digest

Size

93.1 MB

Last updated

over 7 years ago

docker pull takitake/rubyalpine-nokogiri