Skip to content

Instantly share code, notes, and snippets.

@tommydangerous
Created April 26, 2015 17:17
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 tommydangerous/9c376b774ab3988206a5 to your computer and use it in GitHub Desktop.
Save tommydangerous/9c376b774ab3988206a5 to your computer and use it in GitHub Desktop.
Dockerfile (Rails)
FROM ruby
ENV RAILS_ENV production
ENV ROOT_DIR /var/www/app
RUN mkdir -p $ROOT_DIR/tmp
WORKDIR $ROOT_DIR
# Mount volume for Nginx to serve static files from public folder
VOLUME $ROOT_DIR
# Gems
COPY Gemfile $ROOT_DIR/
COPY Gemfile.lock $ROOT_DIR/
RUN bundle install --system
# Add all files
COPY . $ROOT_DIR
# Assets
RUN bundle exec rake assets:precompile assets:clean RAILS_ENV=$RAILS_ENV --trace
COPY start-server.sh /usr/bin/start-server.sh
RUN chmod +x /usr/bin/start-server.sh
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV DB_NAME firebot
EXPOSE 8080
CMD /usr/bin/start-server.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment