Skip to content

Commit 2e60f8f

Browse files
committed
7.1.0.beta1
1 parent 85c3eb0 commit 2e60f8f

File tree

21 files changed

+236
-111
lines changed

21 files changed

+236
-111
lines changed

.dockerignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
6+
# Ignore bundler config.
7+
/.bundle
8+
9+
# Ignore all default key files.
10+
/config/master.key
11+
/config/credentials/*.key
12+
13+
# Ignore all environment files.
14+
/.env*
15+
!/.env.example
16+
17+
# Ignore all logfiles and tempfiles.
18+
/log/*
19+
/tmp/*
20+
!/log/.keep
21+
!/tmp/.keep
22+
23+
# Ignore pidfiles, but keep the directory.
24+
/tmp/pids/*
25+
!/tmp/pids/.keep
26+
27+
# Ignore storage (uploaded files in development and any SQLite databases).
28+
/storage/*
29+
!/storage/.keep
30+
/tmp/storage/*
31+
!/tmp/storage/.keep
32+
33+
# Ignore assets.
34+
/node_modules/
35+
/app/assets/builds/*
36+
!/app/assets/builds/.keep
37+
/public/assets

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ db/schema.rb linguist-generated
55

66
# Mark any vendored files as having been vendored.
77
vendor/* linguist-vendored
8+
config/credentials/*.yml.enc diff=rails_credentials
9+
config/credentials.yml.enc diff=rails_credentials

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
# Ignore bundler config.
88
/.bundle
99

10-
# Ignore the default SQLite database.
11-
/db/*.sqlite3
12-
/db/*.sqlite3-*
13-
1410
# Ignore all logfiles and tempfiles.
1511
/log/*
1612
/tmp/*
@@ -22,7 +18,7 @@
2218
!/tmp/pids/
2319
!/tmp/pids/.keep
2420

25-
# Ignore uploaded files in development.
21+
# Ignore storage (uploaded files in development and any SQLite databases).
2622
/storage/*
2723
!/storage/.keep
2824
/tmp/storage/*

Dockerfile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4+
ARG RUBY_VERSION=your-ruby-version
5+
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
6+
7+
# Rails app lives here
8+
WORKDIR /rails
9+
10+
# Set production environment
11+
ENV RAILS_ENV="production" \
12+
BUNDLE_DEPLOYMENT="1" \
13+
BUNDLE_PATH="/usr/local/bundle" \
14+
BUNDLE_WITHOUT="development"
15+
16+
17+
# Throw-away build stage to reduce size of final image
18+
FROM base as build
19+
20+
# Install packages needed to build gems
21+
RUN apt-get update -qq && \
22+
apt-get install --no-install-recommends -y build-essential git libvips pkg-config
23+
24+
25+
26+
# Install application gems
27+
COPY Gemfile Gemfile.lock ./
28+
RUN bundle install && \
29+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
30+
bundle exec bootsnap precompile --gemfile
31+
32+
33+
34+
# Copy application code
35+
COPY . .
36+
37+
# Precompile bootsnap code for faster boot times
38+
RUN bundle exec bootsnap precompile app/ lib/
39+
40+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
41+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
42+
43+
44+
# Final stage for app image
45+
FROM base
46+
47+
# Install packages needed for deployment
48+
RUN apt-get update -qq && \
49+
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
50+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
51+
52+
# Copy built artifacts: gems, application
53+
COPY --from=build /usr/local/bundle /usr/local/bundle
54+
COPY --from=build /rails /rails
55+
56+
# Run and own only the runtime files as a non-root user for security
57+
RUN useradd rails --create-home --shell /bin/bash && \
58+
chown -R rails:rails db log storage tmp
59+
USER rails:rails
60+
61+
# Entrypoint prepares the database.
62+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
63+
64+
# Start the server by default, this can be overwritten at runtime
65+
EXPOSE 3000
66+
CMD ["./bin/rails", "server"]

Gemfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
source "https://rubygems.org"
2-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
32

43
ruby "your-ruby-version"
54

65
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7-
gem "rails", "~> 7.0.8", ">= 7.0.8.7"
6+
gem "rails", "~> 7.1.0.beta1"
87

98
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
109
gem "sprockets-rails"
@@ -13,7 +12,7 @@ gem "sprockets-rails"
1312
gem "sqlite3", "~> 1.4"
1413

1514
# Use the Puma web server [https://github.com/puma/puma]
16-
gem "puma", "~> 5.0"
15+
gem "puma", ">= 5.0"
1716

1817
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
1918
gem "importmap-rails"
@@ -28,7 +27,7 @@ gem "stimulus-rails"
2827
gem "jbuilder"
2928

3029
# Use Redis adapter to run Action Cable in production
31-
# gem "redis", "~> 4.0"
30+
# gem "redis", ">= 4.0.1"
3231

3332
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
3433
# gem "kredis"
@@ -37,20 +36,17 @@ gem "jbuilder"
3736
# gem "bcrypt", "~> 3.1.7"
3837

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

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

45-
# Use Sass to process CSS
46-
# gem "sassc-rails"
47-
4844
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
4945
# gem "image_processing", "~> 1.2"
5046

5147
group :development, :test do
5248
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
53-
gem "debug", platforms: %i[ mri mingw x64_mingw ]
49+
gem "debug", platforms: %i[ mri windows ]
5450
end
5551

5652
group :development do
@@ -62,6 +58,8 @@ group :development do
6258

6359
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
6460
# gem "spring"
61+
62+
gem "error_highlight", ">= 0.4.0", platforms: [:ruby]
6563
end
6664

6765
group :test do

app/views/layouts/mailer.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
55
<style>
66
/* Email styles need to be inline */
77
</style>

bin/docker-entrypoint

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash -e
2+
3+
# If running the rails server then create or migrate existing database
4+
if [ "${*}" == "./bin/rails server" ]; then
5+
./bin/rails db:prepare
6+
fi
7+
8+
exec "${@}"

bin/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require "fileutils"
55
APP_ROOT = File.expand_path("..", __dir__)
66

77
def system!(*args)
8-
system(*args) || abort("\n== Command #{args} failed ==")
8+
system(*args, exception: true)
99
end
1010

1111
FileUtils.chdir APP_ROOT do

config/application.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
module Railsdiff
1010
class Application < Rails::Application
1111
# Initialize configuration defaults for originally generated Rails version.
12-
config.load_defaults 7.0
12+
config.load_defaults 7.1
13+
14+
# Please, see https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#config-autoload-lib-ignore.
15+
config.autoload_lib(ignore: %w(assets tasks))
1316

1417
# Configuration for the application, engines, and railties goes here.
1518
#

config/database.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ default: &default
1111

1212
development:
1313
<<: *default
14-
database: db/development.sqlite3
14+
database: storage/development.sqlite3
1515

1616
# Warning: The database defined as "test" will be erased and
1717
# re-generated from your development database when you run "rake".
1818
# Do not set this db to the same as development or production.
1919
test:
2020
<<: *default
21-
database: db/test.sqlite3
21+
database: storage/test.sqlite3
2222

2323
production:
2424
<<: *default
25-
database: db/production.sqlite3
25+
database: storage/production.sqlite3

0 commit comments

Comments
 (0)