Created
April 26, 2016 01:44
-
-
Save chsh/c04295713d9794d4589adafd42e712e0 to your computer and use it in GitHub Desktop.
Dockerfile for Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bundle exec rails db:migrate | |
bundle exec rails db:seed | |
bundle exec rails server -p 3000 -b 0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.3.0 | |
# see update.sh for why all "apt-get install"s have to stay as one long line | |
RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/* | |
# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole | |
RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/* | |
ENV RAILS_VERSION 5.0.0.beta3 | |
RUN gem install rails --version "$RAILS_VERSION" | |
RUN mkdir /app | |
WORKDIR /tmp | |
COPY Gemfile Gemfile | |
COPY Gemfile.lock Gemfile.lock | |
RUN bundle install --jobs 20 --retry 5 --without development test | |
ENV RAILS_ENV production | |
ENV RACK_ENV production | |
ENV SECRET_KEY_BASE --SET-YOUR-SECRET-KEY-- | |
# ADD . /app | |
WORKDIR /app | |
COPY . ./ | |
RUN bundle exec rails assets:precompile | |
EXPOSE 3000 | |
ENV RAILS_SERVE_STATIC_FILES 1 | |
# Run it | |
ENTRYPOINT ["bin/start.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment