Skip to content

Instantly share code, notes, and snippets.

@ericraio
Created December 30, 2014 00:47
Show Gist options
  • Save ericraio/f64f69cd4c063ce1b9a0 to your computer and use it in GitHub Desktop.
Save ericraio/f64f69cd4c063ce1b9a0 to your computer and use it in GitHub Desktop.
FROM ruby:2.1.5
#################################
# native libs
#################################
RUN apt-get update -qq
RUN apt-get install -qq -y build-essential
RUN apt-get install -qq -y libpq-dev
RUN apt-get install -qq -y nodejs
RUN apt-get install -qq -y npm
RUN apt-get install -qq -y nginx
# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#################################
# Install Nginx.
#################################
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx
ADD config/nginx.conf /etc/nginx/sites-enabled/default
EXPOSE 80
#################################
# Symlinking Nodejs for ubuntu
# -- http://stackoverflow.com/questions/26320901/cannot-install-nodejs-usr-bin-env-node-no-such-file-or-directory
#################################
RUN ln -s /usr/bin/nodejs /usr/bin/node
#################################
# NPM install globals
#################################
RUN npm install bower -g
#################################
# Rails
#################################
RUN mkdir /app
WORKDIR /app
ADD . /app
RUN mkdir tmp/sockets -p
RUN mkdir tmp/pids -p
ENV RAILS_ENV production
ENV SECRET_KEY_BASE test123
RUN bundle install --without development test
RUN bundle exec rake bower:install
RUN bundle exec rake assets:precompile
CMD foreman start -f Procfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment