Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
laurigates avatar

Nodejs Containers

  • 61 installs
  • 49 repo stars
  • Updated August 4, 2026
  • laurigates/claude-plugins

Helps with ai & agent building tasks.

About

nodejs-containers is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.

  • nodejs-containers
  • AI & Agent Building
  • AI-coding skill

Nodejs Containers by the numbers

  • 61 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #6,312 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/laurigates/claude-plugins --skill nodejs-containers

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs61
repo stars49
Last updatedAugust 4, 2026
Repositorylaurigates/claude-plugins

What it does

Helps with ai & agent building tasks.

Files

SKILL.mdMarkdownGitHub ↗

Node.js Container Optimization

Expert knowledge for building optimized Node.js container images using Alpine variants, multi-stage builds, and Node.js-specific dependency management patterns.

When to Use This Skill

Use this skill when...Use container-development instead when...
Building Node.js-specific DockerfilesGeneral multi-stage build patterns
Optimizing Node.js image sizesLanguage-agnostic container security
Handling npm/yarn/pnpm in containersDocker Compose configuration
Dealing with native module buildsNon-Node.js container optimization

Core Expertise

Node.js Container Challenges:

  • Large node_modules directories (100-500MB)
  • Full base images include build tools (~900MB)
  • Separate dev and production dependencies
  • Different package managers (npm, yarn, pnpm)
  • Native modules requiring build tools

Key Capabilities:

  • Alpine-based images (~100MB vs ~900MB full)
  • Multi-stage builds separating build and runtime
  • BuildKit cache mounts for node_modules
  • Production-only dependency installation
  • Non-root user configuration

Optimized Multi-Stage Pattern (Node Servers)

The recommended pattern achieves ~100-150MB images:

# Dependencies stage - production only
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

# Build stage - includes devDependencies
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Runtime stage - minimal
FROM node:20-alpine
WORKDIR /app

# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
    adduser -u 1001 -S nodejs -G nodejs

# Copy dependencies and built app
COPY --from=deps --chown=nodejs:nodejs /app/node_modules ./node_modules
COPY --from=build --chown=nodejs:nodejs /app/dist ./dist
COPY --chown=nodejs:nodejs package.json ./

USER nodejs
EXPOSE 3000

HEALTHCHECK --interval=30s CMD node healthcheck.js || exit 1

CMD ["node", "dist/server.js"]

BuildKit Cache Mounts (Fastest Builds)

# syntax=docker/dockerfile:1

FROM node:20-alpine AS build
WORKDIR /app

# Cache mount for npm cache
RUN --mount=type=cache,target=/root/.npm \
    --mount=type=bind,source=package.json,target=package.json \
    --mount=type=bind,source=package-lock.json,target=package-lock.json \
    npm ci

COPY . .
RUN npm run build

FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
USER node
CMD ["node", "dist/server.js"]

Build performance:

  • First build: ~2-3 minutes
  • Subsequent builds (no package changes): ~10-20 seconds
  • Subsequent builds (package changes): ~30-60 seconds

Package Manager Patterns

npm

COPY package*.json ./
RUN npm ci --only=production
RUN npm cache clean --force

yarn

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production
RUN yarn cache clean

pnpm

RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod
# pnpm creates smaller node_modules with hard links (20-30% smaller)

Performance Impact

MetricFull Node (900MB)Alpine (350MB)Multi-Stage (100MB)Improvement
Image Size900MB350MB100MB89% reduction
Pull Time3m 20s1m 10s25s87% faster
Build Time4m 30s3m 15s2m 30s44% faster
Rebuild (cached)2m 10s1m 30s15s88% faster
Memory Usage512MB256MB180MB65% reduction

Security Impact

Image TypeVulnerabilitiesSizeRisk
node:20 (Debian)45-60 CVEs900MBHigh
node:20-alpine8-12 CVEs350MBMedium
Multi-stage Alpine4-8 CVEs100MBLow
Distroless Node2-4 CVEs120MBVery Low

Agentic Optimizations

ContextCommandPurpose
Fast rebuildDOCKER_BUILDKIT=1 docker build --target build .Build only build stage
Size checkdocker images app --format "table {{.Repository}}\t{{.Size}}"Compare sizes
Layer analysis`docker history app:latest --human --no-trunc \head -20`
Dependency auditdocker run --rm app npm audit --productionCheck vulnerabilities
Cache cleardocker builder prune --filter type=exec.cachemountClear BuildKit cache
Test locallydocker run --rm -p 3000:3000 appQuick local test

Best Practices

  • Use Alpine variants for smaller images
  • Use npm ci not npm install (reproducible builds)
  • Separate dev and production dependencies
  • Run as non-root user
  • Use multi-stage builds for production
  • Layer package.json separately from source code
  • Add .dockerignore to exclude node_modules, tests

For detailed examples, advanced patterns, and best practices, see REFERENCE.md.

Related Skills

  • container-development - General container patterns, multi-stage builds, security
  • go-containers - Go-specific container optimizations
  • python-containers - Python-specific container optimizations

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.