kamal-docker-production

kamal-docker-production is a skill for Claude Code, Codex from sandeepmvl/rails-skills. It costs 174 tokens per session (4,479 once invoked), scanned D, original, MIT.

A deployment guide for running Ruby on Rails 8 with Docker and Kamal 2. Docker packages the application into containers, while Kamal deploys those containers to production.

In plain words
What is it for?
Use it to create a multi-stage Docker image, run Rails with PostgreSQL and Redis in development, configure Kamal deployment, store secrets safely, and add a health check.
Why use it?
It helps avoid oversized images, native-library problems, leaked secrets, and downtime during deployment.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ./bin/rails db:prepare.

Good fit Use it to create a multi-stage Docker image, run Rails with PostgreSQL and Redis in development, configure Kamal deployment, store secrets safely, and add a health check.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/sandeepmvl/rails-skills
agentmods
npx agentmods add skills/sandeepmvl/rails-skills/09-kamal-docker-production

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kamal-docker-production

README.md
[![agentmods](https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/09-kamal-docker-production/github.svg)](https://agentmods.dev/skills/sandeepmvl/rails-skills/09-kamal-docker-production)
Your own site
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/09-kamal-docker-production"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/09-kamal-docker-production/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kamal-docker-production

Your own site · 80×15
<a href="https://agentmods.dev/skills/sandeepmvl/rails-skills/09-kamal-docker-production"><img src="https://agentmods.dev/badge/skills/sandeepmvl/rails-skills/09-kamal-docker-production.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 174 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,479 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 3 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00174 $0.04479
Opus 5 $0.00087 $0.02240
Sonnet 5 $0.00035 $0.00896
Haiku 4.5 $0.00017 $0.00448

Measured 12d ago against content hash 1a9d9526d59b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade D, and why

kamal-docker-production scanned grade D with 3 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- Don't run as root in production containers.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf /var/lib/apt/lists /var/cache/apt/archives

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl libjemalloc2 libvips postgresql-client && \
skills/09-kamal-docker-production/SKILL.md · 468 lines

How it starts

The opening of the file, as written. The whole thing — 468 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Kamal + Docker for Rails Production

Ship a Rails 8 app to production without managing Kubernetes or paying Heroku 10× markup. AI agents generate Dockerfiles that work but waste 500MB of image size and 4 minutes of build time. They reach for alpine and trip on native gem compilation. This skill encodes the choices a senior infra-aware Rails dev makes.

Why this matters

Rails 8 ships a Dockerfile out of the box, plus Kamal 2 for deployment. Both are good. But the defaults need understanding — what to keep, what to customize, and how to wire secrets without leaking them to images or logs.

The opinion

Use the Rails-generated multi-stage Dockerfile as the starting point. Base on ruby:3.x-slim (debian-slim), not alpine — alpine's musl libc causes subtle native-gem failures with nokogiri, pg, sassc, and libvips. Use bin/docker-entrypoint for runtime setup (db:prepare). Deploy with Kamal 2. Use Rails credentials for app secrets, Kamal envs (.kamal/secrets) for deployment secrets. Health check at GET /up. Never put secrets in the Dockerfile.

Counter-positions:

  • Distroless base images (gcr.io/distroless) are smaller and safer than slim, but every native gem becomes a debugging session. Worth it for super-locked-down envs; over-investment for most.
  • Heroku, Fly.io, Render — managed PaaS. Trade money for engineer-hours. Pick if the team's time is better spent on product than ops. Kamal is the answer when you've decided you want your own VMs.
  • Kubernetes — appropriate when you actually need its features (multi-cluster, auto-scaling on real signals, multi-team isolation). Don't pick K8s for a single Rails app.

Core patterns

Pattern 1: Multi-stage Dockerfile

# syntax=docker/dockerfile:1
# Pin major+minor; pin patch for reproducibility
ARG RUBY_VERSION=3.3.7
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base

# Rails app directory
WORKDIR /rails

# Common deps both stages need
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y \
      curl libjemalloc2 libvips postgresql-client && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Production env defaults
ENV RAILS_ENV="production" \
    BUNDLE_DEPLOYMENT="1" \
    BUNDLE_PATH="/usr/local/bundle" \
    BUNDLE_WITHOUT="development:test" \
    RAILS_SERVE_STATIC_FILES="1" \
    RAILS_LOG_TO_STDOUT="1" \
    MALLOC_ARENA_MAX="2" \
    LD_PRELOAD="libjemalloc.so.2"

# ===== BUILD STAGE =====
FROM base AS build

# Build deps — only here, not in runtime image
RUN apt-get update -qq && \
    apt-get install --no-install-recommends -y \
      build-essential git pkg-config libpq-dev libyaml-dev && \
    rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Bundle install — cache-friendly: copy Gemfiles first, then app
COPY Gemfile Gemfile.lock ./
RUN bundle install --jobs=4 --retry=3 && \
    bundle exec bootsnap precompile --gemfile && \
    rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy app code
COPY . .

# Precompile bootsnap caches + assets
RUN bundle exec bootsnap precompile app/ lib/ && \
    SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile

# ===== RUNTIME STAGE =====
FROM base AS runtime

# Copy gems and app from build stage
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails

# Non-root user — defense in depth
RUN groupadd --system --gid 1000 rails && \
    useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
    chown -R rails:rails db log storage tmp
USER rails:rails

# Entrypoint runs db:prepare on boot; exec replaces shell
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

EXPOSE 80
CMD ["./bin/thrust", "./bin/rails", "server"]

Read the full file on GitHub · 468 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 468 lines · 174 tokens per session scan D 1a9d9526d59b

Subscribe to this mod's changes

kamal-docker-production is a skill published in the GitHub repository sandeepmvl/rails-skills (21 stars, last pushed 3mo ago), licensed MIT. It adds 174 tokens to every session and 4,479 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it D with 3 findings (asks for root, recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

azd-deployment

Deploy containerized frontend + backend applications to Azure Container Apps with remote builds, managed identity, and idempotent infrastructure.

sickn33/agentic-awesome-skills · 29 tokens

openshell-cli

Guide agents through using the OpenShell CLI (openshell) for sandbox management, gateway registration, provider configuration and refresh, policy iteration, settings, service exposure, BYOC workflows, and attached-provider inference. Covers basic through advanced multi-step workflows. Trigger keywords - openshell…

NVIDIA/OpenShell · 128 tokens

langbot-deploy

Deploy and configure a LangBot instance — Docker / Docker Compose, Kubernetes, the config.yaml model, the Box sandbox runtime, the plugin runtime, and the global API key. Use when installing, deploying, upgrading, or configuring LangBot in production or self-hosted environments. Triggers on "deploy langbot", "langbot…

langbot-app/LangBot · 104 tokens

compute-env-setup

Set up a compute environment on a remote provider so Claude Science jobs can run there. Covers direct SSH/conda hosts, Slurm clusters, container-via-bridge runners, and managed-API providers (Modal, GCP, RunPod). Use when standing up a new provider, porting an env to a different backend, adding a tool that needs its…

UnicomAI/wanwu · 134 tokens

azure-cloud-migrate

Assess and migrate cross-cloud workloads to Azure with reports and code conversion. Supports Lambda→Functions, Beanstalk/Heroku/App Engine→App Service, Fargate/Kubernetes/Cloud Run/Spring Boot→Container Apps. WHEN: migrate Lambda to Functions, AWS to Azure, migrate Beanstalk, migrate Heroku, migrate App Engine, Cloud…

microsoft/skills · 106 tokens

atmos-helmfile

Helmfile orchestration: sync/apply/destroy/diff, Kubernetes deployments, varfile generation, EKS integration, source management.

cloudposse/atmos · 33 tokens