Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created November 20, 2018 04:34
Show Gist options
  • Select an option

  • Save makevoid/07b3b3c807cbee982659bb189d104850 to your computer and use it in GitHub Desktop.

Select an option

Save makevoid/07b3b3c807cbee982659bb189d104850 to your computer and use it in GitHub Desktop.
Ruby 2.5 Dockerfile - using multi staged builds
FROM ubuntu:cosmic as ruby
RUN apt update -y
RUN apt install -y ruby-dev git
RUN gem i bundler
FROM ruby as ruby-build
RUN apt install -y build-essential
FROM ruby-build as builder
WORKDIR /app
RUN mkdir -p /app/.bundle
ADD .bundle/config-docker .bundle/config
ADD Gemfile* /app/
RUN bundle --deployment
ENV RACK_ENV production
RUN ls vendor
ADD . /app
FROM ruby
COPY --from=builder /app /app
WORKDIR /app
CMD bundle exec rackup -o 0.0.0.0 -p 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment