Skip to content

Running in a docker (Ubuntu)

Bean edited this page Sep 30, 2015 · 1 revision

You can get version 1.6.1 to work in a docker image by using the below file contents.

File: Dockerfile

FROM  ubuntu:latest

RUN apt-get update
RUN apt-get install -y make curl

# ruby's nokorigi is sometimes described as being 'hard' to install, but the below 2 instructions, bundled with the version specified in Gemfile* make it install nicely
RUN echo 'LC_ALL="en_US.UTF-8"' > /etc/default/locale
RUN apt-get install -y ruby1.9.3

# greatly speeds up nokogiri install
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1
# dependencies for nokogiri gem
RUN apt-get install -y libxml2 libxml2-dev libxslt1-dev

# install bundler
RUN gem install bundler

# install gems
ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN cd /tmp; bundle install

File: Gemfile

source 'https://rubygems.org'

gem 'nokogiri', '>=1.6.1'

File: Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    nokogiri (1.6.1)
      mini_portile (~> 0.5.0)

PLATFORMS
  ruby

DEPENDENCIES
  nokogiri
  rspec
  thor