Deploy previews for Ruby on Rails apps
Push a branch, get a live preview URL. PreviewDrop builds your Rails container and posts the link to the pull request, usually within a couple of minutes — no CI scripts, no serverless rewrites.
db:migrate to your Start command to migrate on boot. Puma runs as a persistent process — Action Cable, background jobs, long-polling endpoints all work the same way they do in production.What the build needs to do
You don't write this. PreviewDrop detects Railsfrom your repo and builds the container for you — a Dockerfile in your repo is not used. The reference below shows the install, build and start steps a working Rails image needs. If detection gets one wrong, set the matching Install, Build or Start command in Project Settings. Your app must listen on $PORT.
Reference (not read by PreviewDrop)FROM ruby:3.3-slim RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY Gemfile Gemfile.lock ./ RUN bundle install --without development test COPY . . RUN SECRET_KEY_BASE=placeholder bundle exec rails assets:precompile RAILS_ENV=production EXPOSE 3000 CMD sh -c "bundle exec rails db:migrate && bundle exec rails server -b 0.0.0.0 -p ${PORT:-3000} -e production"
Environment variables
Set these in the Variables tab of your PreviewDrop project. They're encrypted at rest and injected into every preview container at start.
| Variable | Example value | Note |
|---|---|---|
| SECRET_KEY_BASE | $(bundle exec rails secret) | Required in production mode. Generate one with: bundle exec rails secret |
| RAILS_ENV | production | Set to production so Puma uses the correct config and assets are served. |
| RAILS_SERVE_STATIC_FILES | enabled | Rails disables static file serving in production by default. This env var re-enables it. |
| DATABASE_URL | postgres://user:pass@host:5432/db | Point at a shared dev DB or omit to use SQLite (fine for UI-only previews). |
Common gotchas
SECRET_KEY_BASE is required in production mode
SECRET_KEY_BASE is missing in production. Generate one with bundle exec rails secret and paste it into the PreviewDrop project variables. For previews, any long random string works — don't reuse your production secret.RAILS_SERVE_STATIC_FILES must be set
RAILS_SERVE_STATIC_FILES=enabled so the Puma process serves the precompiled assets itself.Asset precompilation needs a placeholder SECRET_KEY_BASE
assets:precompile at build time with a throw-away SECRET_KEY_BASE=placeholder. Do the same if you set your own Build command — the real secret comes from your project variables at runtime, not baked into the image.Node.js required for asset pipeline
nodejs for Sprockets / importmap. If you use Webpacker or esbuild, commit your JS lockfile and make sure your Build command runs your JS build step before assets:precompile.Why not Vercel or Netlify?
Preview your Rails app in 5 minutes
Connect a repo, push a branch, get a URL. No credit card, no trial clock.
Start free