Skip to content

Instantly share code, notes, and snippets.

@Sjeanpierre
Created March 2, 2015 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sjeanpierre/94f7adf032ec6be33a93 to your computer and use it in GitHub Desktop.
Save Sjeanpierre/94f7adf032ec6be33a93 to your computer and use it in GitHub Desktop.
Dockerfile for ruby

Docker File

FROM tcnksm/centos-ruby:2.1
#throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ONBUILD COPY Gemfile /usr/src/app/
ONBUILD COPY Gemfile.lock /usr/src/app/
ONBUILD RUN bundle install
ONBUILD COPY . /usr/src/app

place Dockerfile at root of app

FROM sjeanpierre/sinatra-base
CMD ["rackup"]

Build

cd <application_root>
docker build -t <new_image_name> .

Run

docker run --rm -e "RACK_ENV=production" -p 9292:9292 -t -i <image_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment