From 68d014f332394de4453599888a8df46d0fa34f0b Mon Sep 17 00:00:00 2001 From: Mike Heft Date: Sun, 7 Jul 2024 08:46:43 -0600 Subject: [PATCH] update ruby version to allow for ebs deployment (#29) --- .github/workflows/rspec_push.yaml | 2 +- .github/workflows/rubocop.yaml | 2 +- .rubocop.yml | 2 +- .ruby-version | 2 +- .tool-versions | 1 + Dockerfile | 20 ++++++++++---------- Gemfile | 2 +- Gemfile.lock | 3 ++- 8 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/rspec_push.yaml b/.github/workflows/rspec_push.yaml index 23bd043..9bf9360 100644 --- a/.github/workflows/rspec_push.yaml +++ b/.github/workflows/rspec_push.yaml @@ -33,7 +33,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3.0" + ruby-version: "3.2.0" - name: Install dependencies run: | diff --git a/.github/workflows/rubocop.yaml b/.github/workflows/rubocop.yaml index 9f96c32..87dd025 100644 --- a/.github/workflows/rubocop.yaml +++ b/.github/workflows/rubocop.yaml @@ -12,7 +12,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.3.0 + ruby-version: 3.2.0 - name: Install dependencies run: | diff --git a/.rubocop.yml b/.rubocop.yml index 397c700..57e8c36 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ require: - ./lib/rubocop/init_autoloader AllCops: - TargetRubyVersion: 3.3.0 + TargetRubyVersion: 3.2.0 Exclude: - "db/**/*" - "config/**/*" diff --git a/.ruby-version b/.ruby-version index 03463f3..944880f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.0 +3.2.0 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..c23af94 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.2.0 diff --git a/Dockerfile b/Dockerfile index 9c28fe4..db481fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.0 +ARG RUBY_VERSION=3.2.0 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here @@ -9,9 +9,9 @@ WORKDIR /rails # Set production environment ENV RAILS_ENV="production" \ - BUNDLE_DEPLOYMENT="1" \ - BUNDLE_PATH="/usr/local/bundle" \ - BUNDLE_WITHOUT="development" + BUNDLE_DEPLOYMENT="1" \ + BUNDLE_PATH="/usr/local/bundle" \ + BUNDLE_WITHOUT="development" # Throw-away build stage to reduce size of final image @@ -19,13 +19,13 @@ FROM base as build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config + apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config # Install application gems COPY Gemfile Gemfile.lock ./ RUN bundle install && \ - rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ - bundle exec bootsnap precompile --gemfile + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ + bundle exec bootsnap precompile --gemfile # Copy application code COPY . . @@ -39,8 +39,8 @@ FROM base # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libvips postgresql-client && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives + apt-get install --no-install-recommends -y curl libvips postgresql-client && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build /usr/local/bundle /usr/local/bundle @@ -48,7 +48,7 @@ COPY --from=build /rails /rails # Run and own only the runtime files as a non-root user for security RUN useradd rails --create-home --shell /bin/bash && \ - chown -R rails:rails db log storage tmp + chown -R rails:rails db log storage tmp USER rails:rails # Entrypoint prepares the database. diff --git a/Gemfile b/Gemfile index c3e3e02..648941b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # frozen_string_literal: true source "https://rubygems.org" -ruby "3.3.0" +ruby "3.2.0" gem "bootsnap", require: false gem "database_cleaner" gem "faker" diff --git a/Gemfile.lock b/Gemfile.lock index 6cbda39..e38e66c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -325,6 +325,7 @@ PLATFORMS aarch64-linux arm-linux arm64-darwin-22 + arm64-darwin-23 x86-linux x86_64-darwin x86_64-linux @@ -357,7 +358,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 3.3.0p0 + ruby 3.2.0p0 BUNDLED WITH 2.5.13