Skip to content

Commit 2fb8881

Browse files
committed
πŸ”₯ Copy fresh Gemfile for Ruby 2.5 each time devcontainer is run
1 parent 739bbba commit 2fb8881

File tree

5 files changed

+6
-67
lines changed

5 files changed

+6
-67
lines changed

β€Ž.devcontainer/2.5/bundle-config/install.shβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
RUBYGEMS_VERSION=3.3.27
33
gem install rubygems-update -v ${RUBYGEMS_VERSION} > /dev/null 2>&1 &&
44
update_rubygems > /dev/null 2>&1
5+
# Depends on making a copy of the Gemfile, so we don't conflict with the Gemfile.lock
6+
# that is probably relegated to newer Ruby.
7+
# We need to set the ENV variable here, but must wait to copy the Gemfile until the postCreateCommand hook.
58
# Ensure we use the right Gemfile
69
echo 'export BUNDLE_GEMFILE=Gemfile-ruby2_5.gemfile' >> ~/.bashrc

β€Ž.devcontainer/2.5/devcontainer.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Ruby 2.5 on Debian",
55
"image": "ruby:2.5-buster",
6-
"postCreateCommand": "bundle install",
6+
"postCreateCommand": "cp Gemfile Gemfile-ruby2_5.gemfile && bundle install",
77

88
// Features to add to the dev container. More info: https://containers.dev/features.
99
// Features run during the image build, and thus before the lifecycle hooks in this file, e.g., postCreateCommand

β€Ž.gitignoreβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
/spec/reports/
88
/tmp/
99
Gemfile.lock
10+
*.gemfile
11+
*.gemfile.lock

β€ŽGemfile-ruby2_5.gemfileβ€Ž

Lines changed: 0 additions & 28 deletions
This file was deleted.

β€ŽGemfile-ruby2_5.gemfile.lockβ€Ž

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
Β (0)