بنقرة واحدة
docker-patterns
Multi-stage builds, security, optimization
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Multi-stage builds, security, optimization
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Build production-ready MCP clients in TypeScript or Python. Handles connection lifecycle, transport abstraction, tool orchestration, security, and error handling. Use for integrating LLM applications with MCP servers.
Comprehensive guide for Zod 4 schema validation library. This skill should be used when migrating from Zod 3, learning Zod 4 idioms, or building new validation schemas. Covers breaking changes, new features, and migration patterns.
| name | Docker Patterns |
| description | Multi-stage builds, security, optimization |
Container best practices and security patterns for 2025.
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine AS production
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["node", "dist/index.js"]
FROM node:20-alpine
# Create app user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
WORKDIR /app
COPY --chown=nextjs:nodejs . .
USER nextjs
CMD ["node", "server.js"]
# ✅ Good - Alpine (small, secure)
FROM node:20-alpine
# ❌ Bad - Full Debian (large attack surface)
FROM node:20
# Scan image
docker scan myapp:latest
# Use Trivy
trivy image myapp:latest
# ✅ Good - Dependencies cached separately
COPY package*.json ./
RUN npm ci
COPY . .
# ❌ Bad - Cache invalidated on any file change
COPY . .
RUN npm ci
node_modules
npm-debug.log
.git
.env
*.md
.vscode
coverage
dist
.next
# ✅ Good - Single RUN
RUN apk add --no-cache git curl && \
npm ci && \
rm -rf /tmp/*
# ❌ Bad - Multiple layers
RUN apk add git
RUN apk add curl
RUN npm ci
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- .:/app
- /app/node_modules
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- DATABASE_URL=postgres://db:5432/myapp
depends_on:
- db
- redis
db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=myapp
ports:
- "5432:5432"
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
postgres_data:
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node healthcheck.js || exit 1
// healthcheck.js
const http = require('http');
const options = {
host: 'localhost',
port: 3000,
path: '/health',
timeout: 2000
};
const request = http.request(options, (res) => {
console.log(`STATUS: ${res.statusCode}`);
process.exitCode = (res.statusCode === 200) ? 0 : 1;
process.exit();
});
request.on('error', () => {
console.log('ERROR');
process.exit(1);
});
request.end();
✅ Do:
latest)❌ Don't:
latest tag