langchain-ai/docker-patterns
Best practices for Docker containerization and multi-stage builds
npx skills add https://github.com/langchain-ai/skills-benchmarks --skill docker-patterns
Build efficient, secure Docker images using modern patterns.
Always use multi-stage builds to minimize image size:
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
# Production stage
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .
USER node
CMD ["node", "server.js"]
USER directivelatestdocker scout or Trivy.dockerignore to exclude sensitive filesHEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1
services:
app:
build:
context: .
target: production
environment:
- NODE_ENV=production
deploy:
resources:
limits:
memory: 512M
Take langchain-ai/docker-patterns from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.