Skip to content

Instantly share code, notes, and snippets.

@peterkeen
Created Jun 27, 2013
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@wyaeld 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