Skip to content

Instantly share code, notes, and snippets.

@l4u
Created June 22, 2015 11:03
Show Gist options
  • Save l4u/98d11d1620570ccfbf76 to your computer and use it in GitHub Desktop.
Save l4u/98d11d1620570ccfbf76 to your computer and use it in GitHub Desktop.
Rails Docker docker-compose cached gems
db:
image: postgres:9.4
web:
build: .
command: bin/rails server --port 3000 --binding 0.0.0.0
ports:
- "3000:3000"
links:
- db
volumes:
- .:/myapp
FROM ruby:2.2.2
RUN apt-get update -qq && apt-get install -y build-essential
# for postgres
RUN apt-get install -y libpq-dev
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
# for a JS runtime
RUN apt-get install -y nodejs
# bundler
RUN gem install bundler && bundle config jobs 7
# myapp
ENV APP_HOME /myapp
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile $APP_HOME/
ADD Gemfile.lock $APP_HOME/
RUN bundle install
ADD Gemfile.tip $APP_HOME/
RUN bundle install
ADD . $APP_HOME
if File.exists?("Gemfile.tip")
eval_gemfile File.join(File.dirname(__FILE__), "Gemfile.tip")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment