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.
git clone --depth 1 https://github.com/sandeepmvl/rails-skillsnpx agentmods add skills/sandeepmvl/rails-skills/09-kamal-docker-productionWrote 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.
[](https://agentmods.dev/skills/sandeepmvl/rails-skills/09-kamal-docker-production)<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.
<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>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00174 | $0.04479 |
| Opus 5.5 | $0.00070 | $0.01792 |
| Sonnet 5.5 | $0.00035 | $0.00896 |
| Haiku 4.5 | $0.00017 | $0.00448 |
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 2mo 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 && \ 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
alpineand 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
Dockerfileas the starting point. Base onruby:3.x-slim(debian-slim), notalpine— alpine's musl libc causes subtle native-gem failures with nokogiri, pg, sassc, and libvips. Usebin/docker-entrypointfor runtime setup (db:prepare). Deploy with Kamal 2. Use Rails credentials for app secrets, Kamal envs (.kamal/secrets) for deployment secrets. Health check atGET /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.4.11
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"]
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.
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.
- 2mo ago Changed 7abc700a1da1
- 3mo ago First seen · 468 lines · 174 tokens per session scan D 1a9d9526d59b
kamal-docker-production is a skill published in the GitHub repository sandeepmvl/rails-skills (22 stars, last pushed 2mo ago), licensed MIT. It adds 174 tokens to every session and 4,479 once invoked, about $0.0007 per session on Opus 5.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.
kamal-docker-production compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| kamal-docker-productionsandeepmvl/rails-skills | Skill | 22 | 2mo ago | MIT | D | 174 | Claude Code, Codex |
| openshell-cliNVIDIA/OpenShell | Skill | 22k | 4d ago | Apache-2.0 | A | 134 | Claude Code, Codex |
| azd-deploymentsickn33/agentic-awesome-skills | Skill | 51k | today | MIT | A | 37 | Claude Code |
| kubernetes-architectsickn33/agentic-awesome-skills | Skill | 51k | today | MIT | A | 31 | Claude Code |
| tao-run-on-slurmNVIDIA/skills | Skill | 4.3k | today | Apache-2.0 | A | 94 | Claude Code |
| cdf-orchestration-setupNVIDIA/skills | Skill | 4.3k | today | Apache-2.0 | A | 105 | Codex |
| langbot-deploylangbot-app/LangBot | Skill | 19k | today | Apache-2.0 | B | 104 | Claude Code, Codex |