Skip to content

Commit

Permalink
chore: update ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
diegosteiner committed Jan 5, 2024
1 parent fff8102 commit 2510a37
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 103 deletions.
32 changes: 18 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@
"service": "app",
// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/home/develop/app",
"workspaceFolder": "/rails",
// Set *default* container specific settings.json values on container create.
"settings": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"terminal.integrated.defaultProfile.linux": "ash"
},
// "settings": {
// "editor.insertSpaces": true,
// "editor.tabSize": 2,
// "terminal.integrated.defaultProfile.linux": "ash"
// },
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"esbenp.prettier-vscode",
"sianglim.slim",
"testdouble.vscode-standard-ruby",
"DavidAnson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"Shopify.ruby-extensions-pack"
],
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"sianglim.slim",
"testdouble.vscode-standard-ruby",
"DavidAnson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"Shopify.ruby-extensions-pack"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [
// 3000
Expand Down
22 changes: 0 additions & 22 deletions .vscode/launch.json

This file was deleted.

60 changes: 25 additions & 35 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
### === base === ###
FROM ruby:3.2.2-alpine AS base
RUN apk add --no-cache --update postgresql-dev tzdata nodejs
FROM ruby:3.3.0-alpine AS base
RUN apk add --no-cache --update postgresql-dev tzdata nodejs npm
RUN gem install bundler

WORKDIR /rails

ENV BUNDLE_PATH="/usr/local/bundle"

RUN adduser -D rails && \
chown -R rails:rails /rails /usr/local/bundle

### === development === ###
FROM base AS development
RUN apk add --update build-base \
python3 \
linux-headers \
gcompat \
git \
Expand All @@ -17,50 +23,34 @@ RUN apk add --update build-base \
openssh-client \
musl musl-utils musl-locales

RUN gem install standardrb ruby-debug-ide debug ruby-lsp
USER rails:rails

ENV BUNDLE_CACHE_ALL=true
ENV BUNDLE_PATH=/home/develop/app/vendor/bundle
RUN adduser -D develop && \
chown -R develop /home/develop
USER develop
RUN mkdir -p /home/develop/app
WORKDIR /home/develop/app
RUN gem install standardrb ruby-lsp

### === build === ###
FROM development AS build
FROM base AS build

ENV RAILS_ENV=production
USER rails:rails

COPY --chown=develop . /home/develop/app
RUN mkdir -p /home/develop/app/vendor/cache && \
mkdir -p /home/develop/app/vendor/bundle && \
mkdir -p /home/develop/app/node_modules
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_WITHOUT="development"

COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle clean && \
bundle package
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

RUN yarn install && \
NODE_ENV=production bin/shakapacker
COPY . .
RUN bundle exec bootsnap precompile app/ lib/

### === production === ###
FROM base AS production

RUN adduser -D app && mkdir -p /app && chown -R app /app
USER app
WORKDIR /app
EXPOSE 3000

ENV BUNDLE_WITHOUT="test:development"
ENV BUNDLE_DEPLOYMENT="true"
ENV BUNDLE_PATH=/app/vendor/bundle
ENV RAILS_ENV=production
ENV NODE_ENV=production
ENV RAILS_LOG_TO_STDOUT="true"
ENV PORT=3000
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails

CMD ["bin/rails", "s", "-b", "0.0.0.0"]
USER rails:rails

COPY --chown=app --from=build /home/develop/app /app
RUN bundle install --local
RUN rm -rf /app/node_modules/*
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

ruby '3.2.2'
ruby '3.3.0'

gem 'active_flag'
gem 'aws-sdk-s3', require: false
Expand Down
45 changes: 24 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ GEM
rake (>= 10.4, < 14.0)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.869.0)
aws-sdk-core (3.190.0)
aws-partitions (1.877.0)
aws-sdk-core (3.190.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.75.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.141.0)
aws-sdk-s3 (1.142.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
Expand All @@ -115,7 +115,8 @@ GEM
bootstrap_form (5.4.0)
actionpack (>= 6.1)
activemodel (>= 6.1)
brakeman (6.1.0)
brakeman (6.1.1)
racc
builder (3.2.4)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
Expand Down Expand Up @@ -185,7 +186,7 @@ GEM
railties (>= 5.0.0)
faker (3.2.2)
i18n (>= 1.8.11, < 2)
faraday (2.7.12)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
Expand Down Expand Up @@ -226,7 +227,7 @@ GEM
nokogiri (>= 1.6)
interception (0.5)
io-console (0.7.1)
irb (1.10.1)
irb (1.11.0)
rdoc
reline (>= 0.3.8)
jmespath (1.6.2)
Expand All @@ -252,8 +253,8 @@ GEM
marcel (1.0.2)
matrix (0.4.2)
memory_profiler (1.0.1)
meta-tags (2.19.0)
actionpack (>= 3.2.0, < 7.2)
meta-tags (2.20.0)
actionpack (>= 6.0.0, < 7.2)
method_source (1.0.0)
mini_mime (1.1.5)
minitest (5.20.0)
Expand All @@ -263,19 +264,20 @@ GEM
msgpack (1.7.2)
multi_json (1.15.0)
mutex_m (0.2.0)
net-imap (0.4.8)
net-imap (0.4.9.1)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.15.5-x86_64-linux)
nokogiri (1.16.0-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
package_json (0.1.0)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
Expand Down Expand Up @@ -305,7 +307,7 @@ GEM
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.0)
puma (6.4.1)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.7.3)
Expand Down Expand Up @@ -370,7 +372,7 @@ GEM
tilt
redis (5.0.8)
redis-client (>= 0.17.0)
redis-client (0.19.0)
redis-client (0.19.1)
connection_pool
regexp_parser (2.8.3)
reline (0.4.1)
Expand Down Expand Up @@ -415,19 +417,19 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop-factory_bot (2.25.0)
rubocop (~> 1.33)
rubocop-performance (1.20.0)
rubocop-performance (1.20.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.0)
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.25.0)
rubocop-rspec (2.26.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
Expand All @@ -439,8 +441,9 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
shakapacker (7.1.0)
shakapacker (7.2.1)
activesupport (>= 5.2)
package_json
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
Expand All @@ -467,7 +470,7 @@ GEM
actionpack (>= 3.1)
railties (>= 3.1)
slim (>= 3.0, < 6.0, != 5.0.0)
squasher (0.7.2)
squasher (0.7.3)
statesman (12.0.0)
statsd-ruby (1.5.0)
stringio (3.1.0)
Expand Down Expand Up @@ -573,7 +576,7 @@ DEPENDENCIES
ttfunk

RUBY VERSION
ruby 3.2.2p53
ruby 3.3.0p0

BUNDLED WITH
2.4.10
4 changes: 2 additions & 2 deletions app/models/mail_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
#

class MailTemplate < RichTextTemplate
def use(booking, to: nil, attach: nil, **context, &)
def use(booking, to: nil, attach: nil, **context, &callback)
return nil unless enabled

booking&.notifications&.build(to:) do |notification|
notification.apply_template(self, context: context.merge(booking:, organisation: booking.organisation))
notification.destroy && return unless notification.deliverable?

notification.attach(attach)
notification.tap(&) if block_given?
notification.tap(&callback) if callback.present?
end
end

Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
target: development
# user: "${UID:-0}:${GID:-0}"
volumes:
- home:/home/develop:cached
- .:/home/develop/app:cached
- .:/rails
- bundle:/usr/local/bundle:cached
ports:
- "3000:3000"
- "3035:3035"
Expand Down Expand Up @@ -68,7 +68,7 @@ services:

volumes:
db_data:
home:
bundle:

networks:
selenium:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"react_ujs": "^3.1.1",
"sass": "^1.68.0",
"sass-loader": "^13.3.2",
"shakapacker": "7.1.0",
"shakapacker": "7.2.1",
"sortablejs": "^1.15.1",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "5.3.9",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6155,10 +6155,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==

shakapacker@7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/shakapacker/-/shakapacker-7.1.0.tgz#95bd37db60702ffa21f9ea29a88f438de3db25b2"
integrity sha512-xKfF4LKrFQdMLYeIi/uBV6pfkPTO4lgCAIMx3W5+MHW61ENOXu4WeQ50qVR9u5hV6XXzi7AiS7C6dWO2GFnYAg==
shakapacker@7.2.1:
version "7.2.1"
resolved "https://registry.yarnpkg.com/shakapacker/-/shakapacker-7.2.1.tgz#de9895bbbb6b6ee1016478dbbb8d4c37b25e5a50"
integrity sha512-IRPkEdIY2JiPfj7fnQ9sP8SBaUcaArMVBHAn3ctB91FndgyaM/bfXXlSEiveWPT3A3wkoadx44U6pKXo1DdC3w==
dependencies:
glob "^7.2.0"
js-yaml "^4.1.0"
Expand Down

0 comments on commit 2510a37

Please sign in to comment.