Containerize app, upgrade Rails to 8.1.3, and overhaul CI#76
Open
Containerize app, upgrade Rails to 8.1.3, and overhaul CI#76
Conversation
## What changed ### Rails upgrade - Bump `rails` from 8.0.3 → 8.1.3 (latest stable) and regenerate Gemfile.lock ### Docker / containerization - Rewrite `Dockerfile` with three named targets: - `development` – all gems installed to system path for live-reload with volume mounts - `builder` – production gems + bootsnap precompile (intermediate) - `production` – lean Alpine runtime, no build tooling; ships to Fly.io / GHCR - Add `docker-compose.yml` for one-command local dev (`docker compose up`) - `web` service with source-code volume mount and persistent SQLite volume - `css` service runs `tailwindcss:watch` alongside the web server - Add `bin/docker-entrypoint` that runs `db:prepare` before the server starts - Expand `.dockerignore` (exclude SQLite files, coverage, editors, etc.) - Add `.env.example` documenting all required/optional environment variables ### GitHub Actions - Update `ruby-ci.yml`: - Upgrade `actions/checkout` v2 → v4 - Enable `bundler-cache: true` on `ruby/setup-ruby` for faster CI - Split into two parallel jobs: `lint` (RuboCop) and `test` (RSpec) - Add `docker.yml` workflow: - Builds the `production` target on every PR/push (validates the image) - Pushes to `ghcr.io/vidhiya-saagar/spg2` on merges to `main` and version tags - Uses GitHub Actions layer cache (`type=gha`) to speed up builds ### README - Add Docker quick-start section (Option A) alongside the existing local setup - Document the three Dockerfile targets and compose commands - Add CI/CD workflow summary table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bin/rails, bin/rake, and bin/setup had shebangs pointing to a specific developer's local RVM path (/Users/dilraj/.rvm/...) which doesn't exist in Docker containers (or anyone else's machine). Replace with the portable #!/usr/bin/env ruby form. This fixes the "exec bin/rails: no such file or directory" error when running `docker compose up`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two issues prevented `docker compose up` from working cleanly: 1. **CSS service crash** – tailwindcss-ruby couldn't find its aarch64 binary because the dev stage used Alpine (musl libc) but platform gems are distributed as gnu binaries. Fix: use ruby:3.4.5-slim (Debian/glibc) for the development target so platform-specific gems work. Production target stays on Alpine for a lean image. 2. **Tailwind platform not in lockfile** – Added aarch64-linux, aarch64-linux-gnu, x86_64-linux-gnu to Gemfile.lock PLATFORMS so bundler selects the correct pre-compiled tailwindcss binary. The stack now boots fully: web server on :1843, Tailwind watcher running, /books and /books/1.json return JSON correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Rails upgrade
railsfrom 8.0.3 → 8.1.3 (latest stable) and regenerate Gemfile.lockDocker / containerization
Dockerfilewith three named targets:development– all gems installed to system path for live-reload with volume mountsbuilder– production gems + bootsnap precompile (intermediate)production– lean Alpine runtime, no build tooling; ships to Fly.io / GHCRdocker-compose.ymlfor one-command local dev (docker compose up)webservice with source-code volume mount and persistent SQLite volumecssservice runstailwindcss:watchalongside the web serverbin/docker-entrypointthat runsdb:preparebefore the server starts.dockerignore(exclude SQLite files, coverage, editors, etc.).env.exampledocumenting all required/optional environment variablesGitHub Actions
ruby-ci.yml:actions/checkoutv2 → v4bundler-cache: trueonruby/setup-rubyfor faster CIlint(RuboCop) andtest(RSpec)docker.ymlworkflow:productiontarget on every PR/push (validates the image)ghcr.io/vidhiya-saagar/spg2on merges tomainand version tagstype=gha) to speed up buildsREADME
Description
New Changes
Closes # (issue)
How Has This Been Tested?