I am using docker to develop an application for rails. The docker file is as follows:
FROM ruby:1.9.3 RUN apt-get update -qq && apt-get install -y build-essential libpq-dev vim ENV APP_HOME /next-reg RUN mkdir $APP_HOME WORKDIR $APP_HOME ENV BUNDLE_PATH /box ADD . $APP_HOME RUN gem install gem1.gem gem2.gem COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock RUN bundle install
As you can see, I am changing bundle_path , this is due to an article showing how we can save the gem load. So overtime, when the docker cache heats up, it merges again and takes FOREVER.
When I docker build it successfully installs gems, then it cannot find them in the package. Can someone give me a hand with persisting gems, set my own gems and make it work?
Before I changed bundle_path , the assembly worked, it was simply re-included often without changes to the gem file (because, I think, the docker image cache was hot).
My docker layout is as follows:
db: image: postgres volumes: - ~/.docker-voumes/postgres/data:/var/lib/postgresql/data # This is to hold and persist ruby gems, referenced in web and in web dockerfile. gem_files: image: busybox volumes: - /box web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - .:/next-reg volumes_from: - gem_files ports: - "3000:3000" - "8000:8000" links: - db env_file: - .myenv.env
source share