
Docker Containerization
Spin up reproducible Next.js dev and production containers with compose, ignores, and HTTP healthchecks before you ship.
Overview
Docker Containerization is an agent skill for the Ship phase that scaffolds Next.js dev/prod Docker Compose, ignore rules, and healthcheck patterns for reproducible runs.
Install
npx skills add https://github.com/ailabs-393/ai-labs-claude-skills --skill docker-containerizationWhat is this skill?
- Dev and prod compose services with separate ports (3000 dev, 3001 prod)
- Bind-mounted dev volumes with isolated node_modules and .next caches
- Production healthcheck hitting /api/health every 30s with retries
- Opinionated .dockerignore excluding tests, docs, CI, and local env files
- restart: unless-stopped on app services on a shared app-network
- 2 compose services: app-dev and app-prod
- Production healthcheck: 30s interval, 3 retries, 3s timeout
Adoption & trust: 805 installs on skills.sh; 399 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You can run the app locally but have no consistent Dockerfile, compose split, or health endpoint for staging and production.
Who is it for?
Indie builders containerizing a Next.js or similar Node web app with separate dev bind-mount and slim production images.
Skip if: Teams that need multi-service stacks (Postgres, Redis, workers) or Kubernetes manifests without extending the template yourself.
When should I use this skill?
You need Docker Compose and ignore templates for a Next.js app with separate development and production run modes.
What do I get? / Deliverables
You get dev and production service definitions, dockerignore defaults, and a healthcheck stub your agent can adapt before you deploy.
- Dockerfile.development and Dockerfile.production patterns
- docker-compose.yml with dev/prod services and healthcheck
- .dockerignore tuned for Node/Next builds
Recommended Skills
Journey fit
Container recipes land when you are ready to package and run the app the same way in staging and production. Launch prep is where Dockerfiles, compose services, and health endpoints get wired—not when you are still sketching features.
How it compares
Use as a compose/Dockerfile starter—not a managed PaaS deploy skill or full observability stack.
Common Questions / FAQ
Who is docker-containerization for?
Solo and indie developers who want agent-guided Docker setup for Next.js-style apps before their first real deploy.
When should I use docker-containerization?
During Ship launch prep when you need dev/prod containers, or in Operate infra work when you are hardening how the app runs in production.
Is docker-containerization safe to install?
Review the Security Audits panel on this Prism page and inspect generated Dockerfiles and env handling before pushing images or exposing ports.
SKILL.md
READMESKILL.md - Docker Containerization
# Dependencies node_modules npm-debug.log* yarn-debug.log* yarn-error.log* .pnpm-debug.log* # Testing coverage *.lcov .nyc_output # Next.js .next/ out/ build dist # Production .vercel .netlify # Misc .DS_Store *.pem .env*.local .env.development .env.test .env.production # Debug logs *.log # Git .git .gitignore .gitattributes # IDE .vscode .idea *.swp *.swo *~ # Documentation README.md docs/ *.md # CI/CD .github/ .gitlab-ci.yml .circleci/ # Docker Dockerfile* docker-compose*.yml .dockerignore # Temporary files tmp/ temp/ version: '3.8' services: # Next.js Application - Development app-dev: build: context: . dockerfile: Dockerfile.development container_name: nextjs-app-dev ports: - "3000:3000" volumes: - .:/app - /app/node_modules - /app/.next environment: - NODE_ENV=development - PORT=3000 networks: - app-network restart: unless-stopped # Next.js Application - Production app-prod: build: context: . dockerfile: Dockerfile.production container_name: nextjs-app-prod ports: - "3001:3000" environment: - NODE_ENV=production - PORT=3000 networks: - app-network restart: unless-stopped healthcheck: test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"] interval: 30s timeout: 3s retries: 3 start_period: 10s # Nginx Reverse Proxy (optional) nginx: image: nginx:alpine container_name: nginx-proxy ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro - ./ssl:/etc/nginx/ssl:ro depends_on: - app-prod networks: - app-network restart: unless-stopped networks: app-network: driver: bridge # Dockerfile for Next.js Development # Optimized for fast rebuilds and hot reloading FROM node:18-alpine LABEL maintainer="your-email@example.com" LABEL description="Next.js Application - Development" # Install dependencies for native modules RUN apk add --no-cache libc6-compat python3 make g++ WORKDIR /app # Copy package files COPY package.json package-lock.json* ./ # Install all dependencies (including devDependencies) RUN npm install && \ npm cache clean --force # Copy application source COPY . . # Expose port for dev server EXPOSE 3000 ENV PORT=3000 ENV NODE_ENV=development # Start development server with hot reload CMD ["npm", "run", "dev"] # Multi-stage Dockerfile for Next.js with Nginx # For static export deployment with Nginx reverse proxy # Stage 1: Build the Next.js application FROM node:18-alpine AS builder WORKDIR /app # Copy package files COPY package.json package-lock.json* ./ # Install dependencies RUN npm ci && npm cache clean --force # Copy application source COPY . . # Build static export ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 RUN npm run build # Stage 2: Nginx server FROM nginx:alpine AS runner LABEL maintainer="your-email@example.com" LABEL description="Next.js Application - Nginx Static" # Copy built files from builder COPY --from=builder /app/out /usr/share/nginx/html # Copy nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1 # Start nginx CMD ["nginx", "-g", "daemon off;"] # Multi-stage Dockerfile for Next.js Production # Optimized for minimal image size and security # Stage 1: Dependencies FROM node:18-alpine AS deps LABEL stage=deps # Install dependencies only when needed RUN apk add --no-cache libc6-compat WORKDIR /app # Copy package files COPY package.json package-lock.json* ./ # Install dependencies with clean install RUN npm ci --only=production && \ npm cache clean --force # Stage 2: Builder FROM