Skip to content

Instantly share code, notes, and snippets.

@rachelmyers
Last active October 7, 2016 01:16
Show Gist options
  • Select an option

  • Save rachelmyers/5a7e0daad6b0599c6aa5b0feb72f534f to your computer and use it in GitHub Desktop.

Select an option

Save rachelmyers/5a7e0daad6b0599c6aa5b0feb72f534f to your computer and use it in GitHub Desktop.

Revisions

  1. rachelmyers revised this gist Oct 7, 2016. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -4,25 +4,28 @@ FROM ruby:2.2
    # This isn't required, but give yourself some credit
    MAINTAINER Your Name Here <Your Email Here>

    # If you get a library from Homebrew (or `apt-get`) to run it locally, add it to
    # here, and it will be installed with `apt-get`.
    # Install packages
    RUN apt-get update && apt-get install -y \
    git \
    nodejs \
    tzdata

    # Copy the application into the docker container.
    # Copy your application into the container.
    COPY . .

    # run `bundle` and `assets:precompile` to do the bulk of the work.
    # Declare arguments that will vary by environment so we can pass them in
    ARG ASSET_HOST
    ARG SECRET_KEY

    # Build your application.
    RUN \
    # Install application gems.
    bundle install --jobs 4 --without development test --with production && \
    # Precompile Rails assets.
    RAILS_ENV=production bundle exec rake assets:precompile && \
    # Precompile Rails assets, using the secret keys
    bundle exec rake ASSET_HOST=${ASSET_HOST} SECRET_KEY=${SECRET_KEY} RAILS_ENV=production assets:precompile && \
    # Clean up build package
    rm -rf /usr/local/lib/ruby/gems/*/cache/* && \
    rm -rf ~/.gem

    # Start the application :tada:
    CMD bin/rails server --port 3000
    # Run the application.
    CMD bin/rails server --port 3000
  2. rachelmyers created this gist Sep 27, 2016.
    28 changes: 28 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # Our base image is Ruby 2.2; it will run on Amazon Linux.
    FROM ruby:2.2

    # This isn't required, but give yourself some credit
    MAINTAINER Your Name Here <Your Email Here>

    # If you get a library from Homebrew (or `apt-get`) to run it locally, add it to
    # here, and it will be installed with `apt-get`.
    RUN apt-get update && apt-get install -y \
    git \
    nodejs \
    tzdata

    # Copy the application into the docker container.
    COPY . .

    # run `bundle` and `assets:precompile` to do the bulk of the work.
    RUN \
    # Install application gems.
    bundle install --jobs 4 --without development test --with production && \
    # Precompile Rails assets.
    RAILS_ENV=production bundle exec rake assets:precompile && \
    # Clean up build package
    rm -rf /usr/local/lib/ruby/gems/*/cache/* && \
    rm -rf ~/.gem

    # Start the application :tada:
    CMD bin/rails server --port 3000