Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Created June 27, 2013 05:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterkeen/5874224 to your computer and use it in GitHub Desktop.
Save peterkeen/5874224 to your computer and use it in GitHub Desktop.
My very first Dockerfile! It installs Ruby 2.0 from scratch, installs bundler, and then vendors in my app and installs dependencies.
MAINTAINER Pete Keen "pete@petekeen.com"
# Use Ubuntu 12.04 as the base image
FROM ubuntu:precise
# Install a bunch of prerequisites
RUN apt-get update
RUN apt-get install -y git-core curl wget libssl1.0.0 python-yaml build-essential libssl-dev
# Install ruby-build
RUN git clone https://github.com/sstephenson/ruby-build.git
RUN cd ruby-build && ./install.sh
RUN mkdir -p /opt/rubies
# Install Ruby 2.0.0-p0
RUN /usr/local/bin/ruby-build 2.0.0-p0 /opt/rubies/2.0.0-p0
ENV PATH /app/bin:/app/vendor/bundle/bin:/opt/rubies/2.0.0-p0/bin:/usr/local/bin:/usr/bin:/bin
RUN gem install bundler
# Vendor in the app, in this case the directory where the Dockerfile is
ADD . /app
# Install app dependencies with bundler
RUN cd /app && bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin
@wyaeld
Copy link

wyaeld commented Sep 28, 2013

Hi @peterkeen

Like the way you have this set up, later versions of Docker appear to be more strict on ordering, and require the FROM to come before the MAINTAINER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment