Skip to content

Add Docker support with build and run scripts#66

Merged
calebl merged 3 commits intomainfrom
calebl/add-dockerfile
Mar 12, 2026
Merged

Add Docker support with build and run scripts#66
calebl merged 3 commits intomainfrom
calebl/add-dockerfile

Conversation

@calebl
Copy link
Owner

@calebl calebl commented Mar 12, 2026

Summary

Added Docker support for containerizing the Rails app for both production deployments and local development with Traefik reverse proxy.

  • Dockerfile: Production-optimized multi-stage build with asset precompilation and non-root user
  • bin/docker-build: Build script that tags images with both custom tags and git SHA for easy versioning
  • bin/docker-run: Convenience script that automatically sets up Traefik and runs the app at draft.localhost alongside other projects without port conflicts
  • README updates: Complete Docker usage documentation covering basic containerization and Traefik integration

Test plan

  • Run bin/docker-build to verify image builds successfully
  • Run bin/docker-run and verify app loads at http://draft.localhost
  • Verify database and storage volumes persist across container restarts
  • Test that Traefik properly routes requests to the container

🤖 Generated with Claude Code

calebl and others added 3 commits March 12, 2026 09:00
Create production-grade Dockerfile with multi-stage build, asset precompilation, and non-root user. Add bin/docker-build script to tag images with git SHA and bin/docker-run script to run with Traefik reverse proxy for local development at draft.localhost. Update README with Docker usage instructions covering basic runs and integration with Traefik for multi-project local dev setup.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Store SQLite DB in /rails/data via DATABASE_URL to avoid volume
  mount overwriting db/ directory (migrations, schema, seeds)
- Fix docker-entrypoint to check first two args instead of last two,
  so db:prepare runs when CMD has extra flags like -b 0.0.0.0
- Make SSL configurable via env vars for local non-HTTPS usage
- Simplify bin/docker-run to map ports directly instead of Traefik
- Use local production.key for RAILS_MASTER_KEY
- Update README with streamlined Docker instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Run Docker container on port 80 so draft.localhost works without
  specifying a port
- Rescue MailerLite errors during signup to prevent 500s when the
  API key is missing or invalid
- Move sqlite3 gem out of dev/test group so it's available in production
- Add production.key to .gitignore
- Use dig for credential access to avoid NoMethodError on nil

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@calebl calebl merged commit 7fb05a1 into main Mar 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant