Skip to content

Commit 81cbf96

Browse files
committed
Initialize repository
0 parents  commit 81cbf96

Some content is hidden

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

78 files changed

+2007
-0
lines changed

.dockerignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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.
11+
/.env*
12+
13+
# Ignore all default key files.
14+
/config/master.key
15+
/config/credentials/*.key
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
38+
39+
# Ignore CI service files.
40+
/.github
41+
42+
# Ignore Kamal files.
43+
/config/deploy*.yml
44+
/.kamal
45+
46+
# Ignore development files
47+
/.devcontainer
48+
49+
# Ignore Docker-related files
50+
/.dockerignore
51+
/Dockerfile*

.gitattributes

Lines changed: 9 additions & 0 deletions
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

Lines changed: 12 additions & 0 deletions
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

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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 common Rails security vulnerabilities using static analysis
23+
run: bin/brakeman --no-pager
24+
25+
scan_js:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Ruby
33+
uses: ruby/setup-ruby@v1
34+
with:
35+
ruby-version: .ruby-version
36+
bundler-cache: true
37+
38+
- name: Scan for security vulnerabilities in JavaScript dependencies
39+
run: bin/importmap audit
40+
41+
lint:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Ruby
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: .ruby-version
51+
bundler-cache: true
52+
53+
- name: Lint code for consistent style
54+
run: bin/rubocop -f github
55+
56+
test:
57+
runs-on: ubuntu-latest
58+
59+
# services:
60+
# redis:
61+
# image: redis
62+
# ports:
63+
# - 6379:6379
64+
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
65+
steps:
66+
- name: Install packages
67+
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config google-chrome-stable
68+
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Set up Ruby
73+
uses: ruby/setup-ruby@v1
74+
with:
75+
ruby-version: .ruby-version
76+
bundler-cache: true
77+
78+
- name: Run tests
79+
env:
80+
RAILS_ENV: test
81+
# REDIS_URL: redis://localhost:6379/0
82+
run: bin/rails db:test:prepare test test:system
83+
84+
- name: Keep screenshots from failed system tests
85+
uses: actions/upload-artifact@v4
86+
if: failure()
87+
with:
88+
name: screenshots
89+
path: ${{ github.workspace }}/tmp/screenshots
90+
if-no-files-found: ignore

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.
11+
/.env*
12+
13+
# Ignore all logfiles and tempfiles.
14+
/log/*
15+
/tmp/*
16+
!/log/.keep
17+
!/tmp/.keep
18+
19+
# Ignore pidfiles, but keep the directory.
20+
/tmp/pids/*
21+
!/tmp/pids/
22+
!/tmp/pids/.keep
23+
24+
# Ignore storage (uploaded files in development and any SQLite databases).
25+
/storage/*
26+
!/storage/.keep
27+
/tmp/storage/*
28+
!/tmp/storage/
29+
!/tmp/storage/.keep
30+
31+
/public/assets
32+
33+
# Ignore master key for decrypting credentials and more.
34+
/config/master.key

.rubocop.yml

Lines changed: 8 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.4.3

Dockerfile

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

Gemfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
source "https://rubygems.org"
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby "3.4.3"
5+
6+
gem "rails", "8.0.2"
7+
gem "propshaft", "1.2.1"
8+
gem "importmap-rails", "2.1.0"
9+
gem "turbo-rails", "2.0.14"
10+
gem "stimulus-rails", "1.3.4"
11+
gem "jbuilder", "2.13.0"
12+
gem "puma", "6.6.0"
13+
gem "bootsnap", "1.18.6", require: false
14+
gem "tzinfo-data", "1.2025.2", platforms: %i[ windows jruby ]
15+
gem "kamal", "2.7.0", require: false
16+
gem "thruster", "0.1.15", require: false
17+
18+
group :development, :test do
19+
gem "sqlite3", "2.7.2"
20+
gem "debug", "1.11.0", platforms: %i[ mri windows ], require: "debug/prelude"
21+
end
22+
23+
group :development do
24+
gem "web-console", "4.2.1"
25+
end
26+
27+
group :test do
28+
gem "capybara", "3.40.0"
29+
gem "selenium-webdriver", "4.9.0"
30+
gem "webdrivers", "5.3.1"
31+
gem "rails-controller-testing", "1.0.5"
32+
gem "minitest", "5.25.5"
33+
gem "minitest-reporters", "1.7.1"
34+
gem "guard", "2.19.1"
35+
gem "guard-minitest", "2.4.6"
36+
end
37+
38+
group :production do
39+
gem "pg", "1.5.9"
40+
end

0 commit comments

Comments
 (0)