Skip to content

Commit 2ab02ee

Browse files
Stop exposing BUNDLER_VERSION and RUBYGEMS_VERSION environment variables into containers
It is a convenient but not required feature and it was causing the following cryptic error in the binstub generated by Bundler itself (but not in the binstub generated by Rubygems) when `BUNDLER_VERSION` was an empty string: ``` /usr/local/lib/ruby/site_ruby/3.0.0/rubygems/requirement.rb:106:in `parse': Illformed requirement [""] (Gem::Requirement::BadRequirementError) from /usr/local/lib/ruby/site_ruby/3.0.0/rubygems/requirement.rb:138:in `block in initialize' from /usr/local/lib/ruby/site_ruby/3.0.0/rubygems/requirement.rb:138:in `map!' from /usr/local/lib/ruby/site_ruby/3.0.0/rubygems/requirement.rb:138:in `initialize' from /bundle/bin/bundle:92:in `new' from /bundle/bin/bundle:92:in `activate_bundler' from /bundle/bin/bundle:81:in `load_bundler!' from /bundle/bin/bundle:105:in `<top (required)>' from /bundle/bin/whenever:17:in `load' from /bundle/bin/whenever:17:in `<main>' ```
1 parent 1d9987a commit 2ab02ee

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ ARG RUBYGEMS_VERSION_ARG="" \
1414
BUNDLER_VERSION_ARG=""
1515

1616
# Define dependencies base versions
17-
ENV RUBYGEMS_VERSION=${RUBYGEMS_VERSION_ARG:-${RUBYGEMS_VERSION}} \
18-
BUNDLER_VERSION=${BUNDLER_VERSION_ARG} \
19-
NODE_VERSION="16" \
17+
ENV NODE_VERSION="16" \
2018
GOSU_VERSION="1.16"
2119

2220
# Define some default variables
@@ -164,8 +162,8 @@ RUN set -eux; \
164162

165163
# Install GEM dependencies
166164
# Note: we still need Bundler 1.x because Bundler auto-switches to it when it encounters a Gemfile.lock with BUNDLED WITH 1.x
167-
RUN gem update --system ${RUBYGEMS_VERSION} \
168-
&& gem install bundler${BUNDLER_VERSION:+:${BUNDLER_VERSION}} \
165+
RUN gem update --system ${RUBYGEMS_VERSION_ARG} \
166+
&& gem install bundler${BUNDLER_VERSION_ARG:+:${BUNDLER_VERSION_ARG}} \
169167
&& gem install bundler:1.17.3
170168

171169
# Add dot files to the home directory skeleton (they persist IRB/Pry/Rails console history, configure Yarn, etc…)

RECIPES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ This can be particularly useful with configurations like the one traditionally s
431431
432432
### Bundler 1.x
433433
434-
Our image uses Bundler 2.x by default, but for convenience, it also embeds Bundler 1.x. To use it in your legacy project, simply set the `BUNDLER_VERSION` environment variable from your `docker-compose.yml`:
434+
Our image uses Bundler 2.x by default, but for convenience, it also embeds Bundler 1.x. To use it in your legacy project, simply set the [(undocumented) `BUNDLER_VERSION` environment variable](https://github.com/rubygems/rubygems/issues/3978) from your `docker-compose.yml`:
435435
436436
```yaml
437437
services:

test/cowsay/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
ruby_cowsay (0.1.2)
4+
ruby_cowsay (0.1.3)
55

66
PLATFORMS
77
ruby
@@ -10,4 +10,4 @@ DEPENDENCIES
1010
ruby_cowsay
1111

1212
BUNDLED WITH
13-
1.16.6
13+
2.4.17

0 commit comments

Comments
 (0)