Skip to content

Commit 74294a5

Browse files
takaokoujiclaude
andcommitted
Add Ruby 2.7 Dockerfile for Rails 5.1-6.0 compatibility
Add Dockerfile.ruby2.7 to support older Rails versions that are not compatible with Ruby 3.2. Based on CI matrix compatibility: Ruby 2.7 supports: - Rails 5.1.7 ✅ - Rails 5.2.8.1 ✅ - Rails 6.0.6 ✅ - Rails 6.1.7.10 (also works with Ruby 3.2) - Rails 7.0.10 (also works with Ruby 3.2) Ruby 3.2 (existing Dockerfile): - Rails 6.1.7.10 ✅ - Rails 7.0.10 ✅ - Rails 7.1.6 ✅ - Rails 7.2.3 ✅ - Rails 8.0.4 ✅ - Rails 8.1.2 ✅ Changes: - Add Dockerfile.ruby2.7 with Ruby 2.7 base image - Update docker-compose.yml to use Ruby 2.7 for Rails 5.1, 5.2, 6.0 - Add bundle-cache-ruby27 volume for separate gem caching - Keep Ruby 3.2 for Rails 6.1-8.1 This ensures all Rails versions in the CI matrix can be tested locally with the appropriate Ruby version. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 5ff7f95 commit 74294a5

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

Dockerfile.ruby2.7

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dockerfile for testing jsonapi-resources with Rails 5.1-7.0 (Ruby 2.7)
2+
3+
FROM ruby:2.7
4+
5+
# Install dependencies
6+
RUN apt-get update -qq && \
7+
apt-get install -y build-essential libpq-dev nodejs && \
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/*
10+
11+
# Set working directory
12+
WORKDIR /app
13+
14+
# Copy Gemfile and gemspec
15+
COPY Gemfile jsonapi-resources.gemspec ./
16+
COPY lib/jsonapi/resources/version.rb ./lib/jsonapi/resources/
17+
18+
# Install bundler
19+
RUN gem install bundler
20+
21+
# Note: bundle install will happen at runtime with specific RAILS_VERSION
22+
# This allows testing multiple Rails versions without rebuilding the image

docker-compose.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
2-
# Base service definition
2+
# Base service definition for Ruby 3.2 (Rails 6.1-8.1)
33
test-base: &test-base
44
build:
55
context: .
@@ -11,25 +11,37 @@ services:
1111
stdin_open: true
1212
tty: true
1313

14+
# Base service definition for Ruby 2.7 (Rails 5.1-7.0)
15+
test-base-ruby27: &test-base-ruby27
16+
build:
17+
context: .
18+
dockerfile: Dockerfile.ruby2.7
19+
volumes:
20+
- .:/app
21+
- bundle-cache-ruby27:/usr/local/bundle
22+
working_dir: /app
23+
stdin_open: true
24+
tty: true
25+
1426
# Rails 5.1.7
1527
rails-5.1:
16-
<<: *test-base
28+
<<: *test-base-ruby27
1729
container_name: jsonapi-rails-5.1
1830
environment:
1931
- RAILS_VERSION=5.1.7
2032
command: bash -c "rm -f Gemfile.lock && bundle install && bundle exec rake test"
2133

2234
# Rails 5.2.8.1
2335
rails-5.2:
24-
<<: *test-base
36+
<<: *test-base-ruby27
2537
container_name: jsonapi-rails-5.2
2638
environment:
2739
- RAILS_VERSION=5.2.8.1
2840
command: bash -c "rm -f Gemfile.lock && bundle install && bundle exec rake test"
2941

3042
# Rails 6.0.6
3143
rails-6.0:
32-
<<: *test-base
44+
<<: *test-base-ruby27
3345
container_name: jsonapi-rails-6.0
3446
environment:
3547
- RAILS_VERSION=6.0.6
@@ -93,3 +105,4 @@ services:
93105

94106
volumes:
95107
bundle-cache:
108+
bundle-cache-ruby27:

0 commit comments

Comments
 (0)