skills/ruby-deploy/SKILL.md
Build and deploy Ruby applications — Bundler, Rails, Rack, asset pipeline, bootsnap, and Dockerfile patterns. Use when deploying a Ruby or Rails project, or when a Gemfile is detected.
npx skillsauth add nixopus/agent ruby-deployInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Project is Ruby if Gemfile exists at the root.
Ruby version priority:
.ruby-version fileGemfile → ruby directivemise.toml or .tool-versionsBundler. Detect Gemfile and Gemfile.lock.
Read from BUNDLED WITH in Gemfile.lock. Install: gem install bundler -v <version>.
| Context | Command |
|---|---|
| Production | bundle config set --local without 'development test' then bundle install |
| With lockfile | bundle install --frozen |
| Without lockfile | bundle install |
BUNDLE_GEMFILE=/app/Gemfile
GEM_PATH=/usr/local/bundle
GEM_HOME=/usr/local/bundle
MALLOC_ARENA_MAX=2
config/environment.rb → load and runconfig.ru → Rack: bundle exec rackup config.ruRakefile → bundle exec rake <task>| Signal | Framework |
|---|---|
| config/application.rb | Rails |
| config.ru | Rack |
| Rakefile | Rake-based app |
When config/application.rb is present:
bundle exec rake assets:precompile (Sprockets or Propshaft)bundle exec bootsnap precompile --gemfile during deps; bundle exec bootsnap precompile app/ lib/ during build| Gem / use | System dependency |
|---|---|
| pg | libpq-dev |
| mysql2 | default-libmysqlclient-dev |
| rmagick | libmagickwand-dev |
| image_processing (vips) | libvips-dev |
| charlock_holmes | libicu-dev, libxml2-dev, libxslt-dev |
| Gem | Build command |
|---|---|
| Sprockets | bundle exec rake assets:precompile |
| Propshaft | bundle exec rake assets:precompile |
Rails API-only (no sprockets-rails, propshaft) skip asset compilation.
When bootsnap is in Gemfile:
bundle exec bootsnap precompile --gemfilebundle exec bootsnap precompile app/ lib/If package.json detected, or execjs gem is used:
npm install (or equivalent)Common for Rails with Webpacker, Vite, or other frontend tooling.
| Optimization | When |
|---|---|
| jemalloc | Install libjemalloc2 for improved memory allocation |
| YJIT | Ruby 3.2+: may need rustc and cargo for compilation |
Copy Gemfile + Gemfile.lock first for layer caching.
RUN --mount=type=cache,target=/usr/local/bundle \
bundle config set --local path /usr/local/bundle \
&& bundle install --frozen
| Stage | Image |
|---|---|
| Build | ruby:3.4-bookworm or ruby:3.4-alpine |
| Runtime | ruby:3.4-slim or ruby:3.4-alpine |
FROM ruby:3.4-bookworm AS base
FROM base AS deps
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local path /usr/local/bundle \
&& bundle install --frozen
FROM base AS build
WORKDIR /app
COPY --from=deps /usr/local/bundle /usr/local/bundle
COPY . .
ENV RAILS_ENV=production
RUN bundle exec bootsnap precompile app/ lib/ \
&& bundle exec rake assets:precompile
FROM ruby:3.4-slim
WORKDIR /app
ENV RAILS_ENV=production
ENV BUNDLE_GEMFILE=/app/Gemfile
ENV GEM_HOME=/usr/local/bundle
ENV GEM_PATH=/usr/local/bundle
COPY --from=deps /usr/local/bundle /usr/local/bundle
COPY --from=build /app/public/assets /app/public/assets
COPY . .
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
FROM ruby:3.4-slim
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local path /usr/local/bundle \
&& bundle install --frozen
COPY . .
EXPOSE 9292
CMD ["bundle", "exec", "rackup", "config.ru", "-o", "0.0.0.0", "-p", "9292"]
BUNDLED WITH in Gemfile.lockSECRET_KEY_BASE must be set even for asset precompilation — use a dummy value at build time: SECRET_KEY_BASE=dummy bundle exec rake assets:precompilebundle exec is required in Docker CMD — running puma directly may use a system gem instead of the bundled oneLD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 or install libjemalloc2bootsnap precompile --gemfile before bundle install will fail silentlytools
Compressed catalog of all Nixopus API operations for the nixopus_api() tool
development
Deploy static file sites — Caddy/nginx serving, Staticfile config, and Dockerfile patterns. Use when deploying a static HTML site with no server-side runtime, or when index.html or a Staticfile is detected at the project root.
devops
Deploy shell script applications — interpreter detection, setup scripts, and Dockerfile patterns. Use when deploying a shell script project, or when start.sh is detected.
development
Self-healing loop for failed deployments — diagnose, fix, redeploy up to 3 attempts, then escalate or rollback. Load when a deployment fails or build errors occur.