Skip to content

Commit 01dbf35

Browse files
committed
Initial commit
Commit right after executing the following: ```bash rails new rails-new-io --database=sqlite3 --asset-pipeline=propshaft --javascript=esbuild --css=tailwind --skip-jbuilder --skip-spring --skip-action-mailbox --skip-action-text --skip-active-storage --no-devcontainer cd rails-new-io bin/setup ```
0 parents  commit 01dbf35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2820
-0
lines changed

.dockerignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
/.gitignore
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files (except templates).
11+
/.env*
12+
!/.env*.erb
13+
14+
# Ignore all default key files.
15+
/config/master.key
16+
/config/credentials/*.key
17+
18+
# Ignore all logfiles and tempfiles.
19+
/log/*
20+
/tmp/*
21+
!/log/.keep
22+
!/tmp/.keep
23+
24+
# Ignore pidfiles, but keep the directory.
25+
/tmp/pids/*
26+
!/tmp/pids/.keep
27+
28+
# Ignore storage (uploaded files in development and any SQLite databases).
29+
/storage/*
30+
!/storage/.keep
31+
/tmp/storage/*
32+
!/tmp/storage/.keep
33+
34+
# Ignore assets.
35+
/node_modules/
36+
/app/assets/builds/*
37+
!/app/assets/builds/.keep
38+
/public/assets
39+
40+
# Ignore CI service files.
41+
/.github
42+
43+
# Ignore development files
44+
/.devcontainer
45+
46+
# Ignore Docker-related files
47+
/.dockerignore
48+
/Dockerfile*

.gitattributes

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored
8+
config/credentials/*.yml.enc diff=rails_credentials
9+
config/credentials.yml.enc diff=rails_credentials

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: bundler
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
- package-ecosystem: github-actions
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 10

.github/workflows/ci.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
scan_ruby:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: .ruby-version
20+
bundler-cache: true
21+
22+
- name: Scan for security vulnerabilities in Ruby dependencies
23+
run: bin/brakeman --no-pager
24+
25+
lint:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: .ruby-version
35+
bundler-cache: true
36+
37+
- name: Lint code for consistent style
38+
run: bin/rubocop -f github
39+
40+
test:
41+
runs-on: ubuntu-latest
42+
43+
# services:
44+
# redis:
45+
# image: redis
46+
# ports:
47+
# - 6379:6379
48+
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
49+
steps:
50+
- name: Install packages
51+
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libsqlite3-0 libsqlite3-0
52+
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Ruby
57+
uses: ruby/setup-ruby@v1
58+
with:
59+
ruby-version: .ruby-version
60+
bundler-cache: true
61+
62+
- name: Run tests
63+
env:
64+
RAILS_ENV: test
65+
# REDIS_URL: redis://localhost:6379/0
66+
run: bin/rails db:test:prepare test test:system
67+
68+
- name: Keep screenshots from failed system tests
69+
uses: actions/upload-artifact@v4
70+
if: failure()
71+
with:
72+
name: screenshots
73+
path: ${{ github.workspace }}/tmp/screenshots
74+
if-no-files-found: ignore

.gitignore

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# Temporary files generated by your text editor or operating system
4+
# belong in git's global ignore instead:
5+
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files (except templates).
11+
/.env*
12+
!/.env*.erb
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*
16+
/tmp/*
17+
!/log/.keep
18+
!/tmp/.keep
19+
20+
# Ignore pidfiles, but keep the directory.
21+
/tmp/pids/*
22+
!/tmp/pids/
23+
!/tmp/pids/.keep
24+
25+
# Ignore storage (uploaded files in development and any SQLite databases).
26+
/storage/*
27+
!/storage/.keep
28+
/tmp/storage/*
29+
!/tmp/storage/
30+
!/tmp/storage/.keep
31+
32+
/public/assets
33+
34+
# Ignore master key for decrypting credentials and more.
35+
/config/master.key
36+
37+
/app/assets/builds/*
38+
!/app/assets/builds/.keep
39+
40+
/node_modules

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.3.0

.rubocop.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Omakase Ruby styling for Rails
2+
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3+
4+
# Overwrite or add rules to create your own house style
5+
#
6+
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7+
# Layout/SpaceInsideArrayLiteralBrackets:
8+
# Enabled: false

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby-3.3.3

Dockerfile

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
4+
# docker build -t my-app .
5+
# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
6+
7+
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
8+
9+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
10+
ARG RUBY_VERSION=3.3.3
11+
FROM docker.io/library/ruby:$RUBY_VERSION-slim as base
12+
13+
# Rails app lives here
14+
WORKDIR /rails
15+
16+
# Install base packages
17+
RUN apt-get update -qq && \
18+
apt-get install --no-install-recommends -y curl libjemalloc2 libsqlite3-0 && \
19+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
20+
21+
# Set production environment
22+
ENV RAILS_ENV="production" \
23+
BUNDLE_DEPLOYMENT="1" \
24+
BUNDLE_PATH="/usr/local/bundle" \
25+
BUNDLE_WITHOUT="development"
26+
27+
# Throw-away build stage to reduce size of final image
28+
FROM base as build
29+
30+
# Install packages needed to build gems and node modules
31+
RUN apt-get update -qq && \
32+
apt-get install --no-install-recommends -y build-essential git node-gyp pkg-config python-is-python3 && \
33+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
34+
35+
# Install JavaScript dependencies
36+
ARG NODE_VERSION=18.19.0
37+
ARG YARN_VERSION=1.22.19
38+
ENV PATH=/usr/local/node/bin:$PATH
39+
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
40+
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
41+
npm install -g yarn@$YARN_VERSION && \
42+
rm -rf /tmp/node-build-master
43+
44+
# Install application gems
45+
COPY Gemfile Gemfile.lock ./
46+
RUN bundle install && \
47+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
48+
bundle exec bootsnap precompile --gemfile
49+
50+
# Install node modules
51+
COPY package.json yarn.lock ./
52+
RUN yarn install --frozen-lockfile
53+
54+
# Copy application code
55+
COPY . .
56+
57+
# Precompile bootsnap code for faster boot times
58+
RUN bundle exec bootsnap precompile app/ lib/
59+
60+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
61+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
62+
63+
64+
RUN rm -rf node_modules
65+
66+
67+
# Final stage for app image
68+
FROM base
69+
70+
# Copy built artifacts: gems, application
71+
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
72+
COPY --from=build /rails /rails
73+
74+
# Run and own only the runtime files as a non-root user for security
75+
RUN groupadd --system --gid 1000 rails && \
76+
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
77+
chown -R rails:rails db log storage tmp
78+
USER 1000:1000
79+
80+
# Entrypoint prepares the database.
81+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
82+
83+
# Start the server by default, this can be overwritten at runtime
84+
EXPOSE 3000
85+
CMD ["./bin/rails", "server"]

Gemfile

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
source "https://rubygems.org"
2+
3+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
4+
gem "rails", "~> 7.2.0.beta2"
5+
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
6+
gem "propshaft"
7+
# Use sqlite3 as the database for Active Record
8+
gem "sqlite3", ">= 1.4"
9+
# Use the Puma web server [https://github.com/puma/puma]
10+
gem "puma", ">= 5.0"
11+
# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
12+
gem "jsbundling-rails"
13+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
14+
gem "turbo-rails"
15+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
16+
gem "stimulus-rails"
17+
# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
18+
gem "cssbundling-rails"
19+
# Use Redis adapter to run Action Cable in production
20+
gem "redis", ">= 4.0.1"
21+
22+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
23+
# gem "kredis"
24+
25+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
26+
# gem "bcrypt", "~> 3.1.7"
27+
28+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
29+
gem "tzinfo-data", platforms: %i[ windows jruby ]
30+
31+
# Reduces boot times through caching; required in config/boot.rb
32+
gem "bootsnap", require: false
33+
34+
group :development, :test do
35+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
36+
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
37+
38+
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
39+
gem "brakeman", require: false
40+
41+
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
42+
gem "rubocop-rails-omakase", require: false
43+
end
44+
45+
group :development do
46+
# Use console on exceptions pages [https://github.com/rails/web-console]
47+
gem "web-console"
48+
end
49+
50+
group :test do
51+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
52+
gem "capybara"
53+
gem "selenium-webdriver"
54+
end

0 commit comments

Comments
 (0)