Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions .circleci/config.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.git
.gitignore
.circleci
.ruby-lsp
/log/*
/tmp/*
/db/*.sqlite3
/vendor/bundle
/node_modules
/coverage
/coverage.data
/public/assets
/public/packs
/spec
/config/database.yml
/config/secrets.yml
.env
.env.*
!.env.example
README.md
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copy this file to .env and fill in your Castle credentials.
# Grab them from the Castle dashboard: https://dashboard.castle.io (Settings -> API).

# Server-side API secret, used by the castle-rb SDK.
CASTLE_API_SECRET=

# Publishable key, used by the browser SDK to mint request tokens.
CASTLE_PK=

# Optional: Twitter/X OAuth credentials for the social login demo.
TWITTER_APP_ID=
TWITTER_SECRET=

# Required in production only (generate with `bin/rails secret`).
# SECRET_KEY_BASE=
28 changes: 28 additions & 0 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Specs

on:
push:
branches: [master]
pull_request:

jobs:
specs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
# Reads the version from .ruby-version and installs the bundler
# pinned in Gemfile.lock (BUNDLED WITH).
bundler-cache: true

- name: Set up the test database
run: |
cp config/database.yml.example config/database.yml
bundle exec rails db:test:prepare

- name: Run the test suite
run: bundle exec rspec
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ db/*.sqlite3
.byebug_history
.redcar/
.sass-cache
db/*.sqlite3-*
/config/*.yml
!/config/storage.yml
/config/secrets.yml

# Local environment variables (secrets). Keep .env.example tracked.
/.env
/.env.*
!/.env.example
/coverage.data
/db/*.javadb/
/db/*.sqlite3
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.7.2
3.4.9
66 changes: 66 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# syntax=docker/dockerfile:1

# ---------- Build stage ----------
FROM ruby:3.4.9-slim AS build

ENV RAILS_ENV=production \
BUNDLE_DEPLOYMENT=1 \
BUNDLE_WITHOUT=development:test \
BUNDLE_PATH=/usr/local/bundle \
BUNDLER_VERSION=2.7.2

RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libsqlite3-dev libyaml-dev pkg-config && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY Gemfile Gemfile.lock .ruby-version ./
RUN gem install bundler -v "${BUNDLER_VERSION}" && \
bundle install && \
rm -rf "${BUNDLE_PATH}"/ruby/*/cache

COPY . .

# The real database.yml is environment-specific and git-ignored; derive it from
# the committed example so the build is reproducible from a clean checkout.
RUN cp config/database.yml.example config/database.yml

# Precompile bootsnap and assets. SECRET_KEY_BASE_DUMMY lets us build assets
# without baking a real secret into the image.
RUN bundle exec bootsnap precompile app/ lib/ || true && \
SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile

# ---------- Runtime stage ----------
FROM ruby:3.4.9-slim AS runtime

ENV RAILS_ENV=production \
BUNDLE_DEPLOYMENT=1 \
BUNDLE_WITHOUT=development:test \
BUNDLE_PATH=/usr/local/bundle \
BUNDLER_VERSION=2.7.2 \
RAILS_SERVE_STATIC_FILES=1 \
RAILS_LOG_TO_STDOUT=1 \
PORT=3000

RUN apt-get update -qq && \
apt-get install --no-install-recommends -y libsqlite3-0 libyaml-0-2 && \
rm -rf /var/lib/apt/lists/* && \
gem install bundler -v "${BUNDLER_VERSION}"

# Run as an unprivileged user.
RUN groupadd --system --gid 1000 rails && \
useradd --system --uid 1000 --gid 1000 --create-home rails

WORKDIR /app

COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /app /app

RUN mkdir -p db log tmp && chown -R rails:rails db log tmp
USER rails

EXPOSE 3000

ENTRYPOINT ["./bin/docker-entrypoint"]
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
31 changes: 18 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,33 @@

source 'https://rubygems.org'

ruby '2.7.2'
ruby file: '.ruby-version'

gem 'bootstrap'
gem 'castle-rb'
gem 'devise'
gem 'hamlit'
gem 'jquery-rails'
gem 'bootsnap', require: false
gem 'bootstrap', '~> 5.3'
gem 'castle-rb', '~> 8.1'
gem 'devise', '~> 5.0'
gem 'dotenv-rails'
gem 'hamlit-rails'
gem 'omniauth-rails_csrf_protection'
gem 'omniauth-twitter'
gem 'puma'
gem 'rails'
gem 'rails-ujs'
gem 'puma', '~> 6.4'
gem 'rails', '~> 8.1.3'
gem 'responders'
gem 'sass-rails'
gem 'sassc-rails'
gem 'simple_form'
gem 'sqlite3'
gem 'uglifier'
gem 'sprockets-rails'
gem 'sqlite3', '~> 2.1'

group :development, :test do
gem 'byebug'
gem 'factory_bot_rails'
gem 'faker'
gem 'rails-controller-testing'
gem 'rspec-rails'
gem 'simplecov'
gem 'simplecov', require: false
end

group :development do
gem 'web-console'
end
Loading