Skip to content

Commit

Permalink
upgrade to Rails 7
Browse files Browse the repository at this point in the history
* update ruby to 3.1.1
* update CircleCI
* update Docker
  • Loading branch information
aktfrikshun authored Mar 17, 2022
1 parent 36fddb0 commit 4cd8c91
Show file tree
Hide file tree
Showing 21 changed files with 809 additions and 524 deletions.
9 changes: 8 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.7.4-node-browsers
- image: cimg/ruby:3.1.1-browsers
environment:
RAILS_ENV: test
PGHOST: 127.0.0.1
Expand Down Expand Up @@ -41,6 +41,13 @@ jobs:
- run: bundle exec rake db:create
- run: bundle exec rake db:schema:load

# Install chrome driver
- run:
name: Setup Chrome
command: |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
# run tests!
- run:
name: run tests
Expand Down
3 changes: 3 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ [email protected]
TOUCHPOINTS_SUPPORT=[email protected]
TOUCHPOINTS_TEAM=[email protected]
TOUCHPOINTS_WEB_DOMAIN=127.0.0.1

DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true

42 changes: 14 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
# gets the docker image of ruby 2.5 and lets us build on top of that
FROM ruby:2.6.5-slim
FROM ruby:3.1.1-slim

# install rails dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client && apt-get install -y git
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
postgresql-client \
nodejs \
git \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# create a folder /FlexUOMConverter in the docker container and go into that folder
RUN mkdir /touchpoints
WORKDIR /touchpoints
RUN gem update --system
RUN gem install bundler:2.3.8

# Copy the Gemfile and Gemfile.lock from app root directory into the /myapp/ folder in the docker container
COPY Gemfile /touchpoints/Gemfile
WORKDIR /usr/src/app

# Run bundle install to install gems inside the gemfile
RUN bundle install
ENTRYPOINT ["./entrypoint.sh"]

EXPOSE 3002

# Copy the whole app
COPY . /touchpoints

RUN cd /touchpoints

# Expose port 3000 to the Docker host, so we can access it
# from the outside.
EXPOSE 3000

# Configure an entry point, so we don't need to specify
# "bundle exec" for each of our commands.
ENTRYPOINT ["bundle", "exec"]

# The main command to run when the container starts. Also
# tell the Rails dev server to bind to all interfaces by
# default.
CMD ["rails", "server", "-b", "0.0.0.0"]
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"]
59 changes: 51 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.4'
ruby '3.1.1'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.2", ">= 7.0.2.2"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.3"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.6"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"

# Hotwire"s SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"

# Hotwire"s modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Redis adapter to run Action Cable in production
gem "redis", "~> 4.6"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Sass to process CSS
# gem "sassc-rails", "~> 2.1"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem "image_processing", "~> 1.12"

gem "brakeman"
gem "bundler-audit"
gem "rubocop-rails"

gem 'active_model_serializers', '>= 0.10.13'
gem 'acts-as-list'
Expand All @@ -19,16 +68,12 @@ gem 'mini_magick'
gem 'newrelic_rpm'
gem 'omniauth-github'
gem 'omniauth_login_dot_gov', git: 'https://github.com/18F/omniauth_login_dot_gov.git', branch: 'main'
gem 'rails', '>= 6.1.4.4'
gem 'pg', '~> 1.3.1'
gem 'puma', '~> 5.6.2'
gem 'rack-cors', '>= 1.1.1', require: 'rack/cors'
gem 'sass-rails', '>= 6.0.0'
gem 'sidekiq'
gem 'uglifier'
gem 'json-jwt'
# Use Redis to cache Touchpoints in all envs
gem 'redis'
gem 'redis-namespace'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
Expand All @@ -37,7 +82,7 @@ gem 'aasm', '~> 5.2.0'
gem 'whenever', require: false
gem 'logstop'
gem 'paper_trail'
gem 'acts-as-taggable-on', '~> 8.0'
gem 'acts-as-taggable-on'
gem "rolify"

group :development, :test do
Expand Down Expand Up @@ -66,5 +111,3 @@ group :test do
gem 'webdrivers', '>= 5.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Loading

0 comments on commit 4cd8c91

Please sign in to comment.