Skip to content

Instantly share code, notes, and snippets.

@guiman
Created May 3, 2015 09:13
Show Gist options
  • Save guiman/b097e9bf6c6a4c449404 to your computer and use it in GitHub Desktop.
Save guiman/b097e9bf6c6a4c449404 to your computer and use it in GitHub Desktop.
Example dockerfile for rails app
FROM ruby:2.2
MAINTAINER Alvaro F. Lara <alvaro.lara@alliants.com>
ENV HOME /home/app
ENV RAILS_ENV development
EXPOSE 8080
RUN useradd -m -s /bin/bash app
RUN apt-get update && apt-get install -y ca-certificates build-essential libmysqlclient-dev ruby-mysql
RUN gem install -N bundler
ADD . /home/app/
WORKDIR /home/app
RUN bundle install
RUN ln -sf /config/database.yml $HOME/config/database.yml
RUN ln -sf $HOME/log /log
RUN echo '#!/bin/bash \n bundle exec rake db:migrate; bundle exec unicorn -c ./config/unicorn.rb -E RAILS_ENV' > /home/app/startup.sh; \
chmod +x /home/app/startup.sh
CMD ["/home/app/startup.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment