Public | Automated Build

Last pushed: a year ago
Short Description
Ruby runtime with Nokogiri
Full Description

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
Docker Pull Command
Owner
takitake

Comments (0)