Skip to content

Instantly share code, notes, and snippets.

@pxlpnk
Created October 10, 2019 03:43
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 pxlpnk/ad18fd93355f56e10fdae9b741fcd938 to your computer and use it in GitHub Desktop.
Save pxlpnk/ad18fd93355f56e10fdae9b741fcd938 to your computer and use it in GitHub Desktop.
FROM ubuntu:18.04
FROM ruby:2.6.3
# Install apt based dependencies required to run Rails as
# well as RubyGems. As the Ruby image itself is based on a
# Debian image, we use apt-get to install those.
RUN apt-get update && apt-get install -y \
build-essential
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
# Configure the main working directory. This is the base
# directory used in any further RUN, COPY, and ENTRYPOINT
# commands.
RUN mkdir -p /app
WORKDIR /app
# Copy the Gemfile as well as the Gemfile.lock and install
# the RubyGems. This is a separate step so the dependencies
# will be cached unless changes to one of those two files
# are made.
COPY Gemfile Gemfile.lock .ruby-version ./
RUN gem install bundler && bundle install
# Copy the main application.
COPY . ./
# Create a database.yml file
RUN mv ./config/database.yml.example ./config/database.yml
# Expose port 3000 to the Docker host, so we can access it
# from the outside.
EXPOSE 3000
# The main command to run when the container starts. Also
# tell the Rails dev server to bind to all interfaces by
# default.
ENV RAILS_ENV production
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment