Skip to content

Commit d7fe6ad

Browse files
committed
Merge pull request #21 from infosiftr/simpler-bundler
Simplify bundler config so "bundle install" does the right thing by default
2 parents 84808bb + f9a2625 commit d7fe6ad

File tree

6 files changed

+51
-18
lines changed

6 files changed

+51
-18
lines changed

1.9/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ RUN apt-get update \
2222
&& rm -r /usr/src/ruby
2323

2424
# skip installing gem documentation
25-
RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc
25+
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc"
2626

27-
RUN gem install bundler
27+
# install things globally, for great justice
28+
ENV GEM_HOME /usr/local/bundle
29+
ENV PATH $GEM_HOME/bin:$PATH
30+
RUN gem install bundler \
31+
&& bundle config --global path "$GEM_HOME" \
32+
&& bundle config --global bin "$GEM_HOME/bin"
33+
34+
# don't create ".bundle" in all our apps
35+
ENV BUNDLE_APP_CONFIG $GEM_HOME
2836

2937
CMD [ "irb" ]

1.9/onbuild/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
FROM ruby:1.9.3-p547
22

3+
# throw errors if Gemfile has been modified since Gemfile.lock
4+
RUN bundle config --global frozen 1
5+
36
RUN mkdir -p /usr/src/app
47
WORKDIR /usr/src/app
58

6-
ONBUILD ADD Gemfile /usr/src/app/
7-
ONBUILD ADD Gemfile.lock /usr/src/app/
8-
ONBUILD RUN bundle install --system
9+
ONBUILD COPY Gemfile /usr/src/app/
10+
ONBUILD COPY Gemfile.lock /usr/src/app/
11+
ONBUILD RUN bundle install
912

10-
ONBUILD ADD . /usr/src/app
13+
ONBUILD COPY . /usr/src/app

2.0/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ RUN apt-get update \
2222
&& rm -r /usr/src/ruby
2323

2424
# skip installing gem documentation
25-
RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc
25+
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc"
2626

27-
RUN gem install bundler
27+
# install things globally, for great justice
28+
ENV GEM_HOME /usr/local/bundle
29+
ENV PATH $GEM_HOME/bin:$PATH
30+
RUN gem install bundler \
31+
&& bundle config --global path "$GEM_HOME" \
32+
&& bundle config --global bin "$GEM_HOME/bin"
33+
34+
# don't create ".bundle" in all our apps
35+
ENV BUNDLE_APP_CONFIG $GEM_HOME
2836

2937
CMD [ "irb" ]

2.0/onbuild/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
FROM ruby:2.0.0-p576
22

3+
# throw errors if Gemfile has been modified since Gemfile.lock
4+
RUN bundle config --global frozen 1
5+
36
RUN mkdir -p /usr/src/app
47
WORKDIR /usr/src/app
58

6-
ONBUILD ADD Gemfile /usr/src/app/
7-
ONBUILD ADD Gemfile.lock /usr/src/app/
8-
ONBUILD RUN bundle install --system
9+
ONBUILD COPY Gemfile /usr/src/app/
10+
ONBUILD COPY Gemfile.lock /usr/src/app/
11+
ONBUILD RUN bundle install
912

10-
ONBUILD ADD . /usr/src/app
13+
ONBUILD COPY . /usr/src/app

2.1/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ RUN apt-get update \
2222
&& rm -r /usr/src/ruby
2323

2424
# skip installing gem documentation
25-
RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc
25+
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc"
2626

27-
RUN gem install bundler
27+
# install things globally, for great justice
28+
ENV GEM_HOME /usr/local/bundle
29+
ENV PATH $GEM_HOME/bin:$PATH
30+
RUN gem install bundler \
31+
&& bundle config --global path "$GEM_HOME" \
32+
&& bundle config --global bin "$GEM_HOME/bin"
33+
34+
# don't create ".bundle" in all our apps
35+
ENV BUNDLE_APP_CONFIG $GEM_HOME
2836

2937
CMD [ "irb" ]

2.1/onbuild/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
FROM ruby:2.1.3
22

3+
# throw errors if Gemfile has been modified since Gemfile.lock
4+
RUN bundle config --global frozen 1
5+
36
RUN mkdir -p /usr/src/app
47
WORKDIR /usr/src/app
58

6-
ONBUILD ADD Gemfile /usr/src/app/
7-
ONBUILD ADD Gemfile.lock /usr/src/app/
8-
ONBUILD RUN bundle install --system
9+
ONBUILD COPY Gemfile /usr/src/app/
10+
ONBUILD COPY Gemfile.lock /usr/src/app/
11+
ONBUILD RUN bundle install
912

10-
ONBUILD ADD . /usr/src/app
13+
ONBUILD COPY . /usr/src/app

0 commit comments

Comments
 (0)