用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Dev-Toolbelt/dev-team-agents --skill docker-prod命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | docker-prod |
| description | Docker prod — image optimization, multi-stage builds, best practices. |
latest tags in production# ─── Stage 1: Build ───────────────────────────────────────────
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# ─── Stage 2: Runtime ─────────────────────────────────────────
FROM node:20-alpine AS runtime
# Security: non-root user
RUN addgroup -g 1001 appgroup && \
adduser -D -u 1001 -G appgroup appuser
WORKDIR /app
# Copy only what's needed
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=builder --chown=appuser:appgroup /app/package.json .
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "dist/index.js"]
FROM dunglas/frankenphp:1-php8.3-alpine AS base
RUN install-php-extensions \
pdo_pgsql \
redis \
opcache \
intl
# ─── Build stage ──────────────────────────────────────────────
FROM base AS builder
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-scripts --prefer-dist --optimize-autoloader
COPY . .
RUN composer run-script post-autoload-dump
# ─── Runtime stage ────────────────────────────────────────────
FROM base AS runtime
RUN addgroup -g 1001 appgroup && \
adduser -D -u 1001 -G appgroup www-data-custom
WORKDIR /app
COPY --from=builder --chown=www-data-custom:appgroup /app .
USER www-data-custom
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD wget -qO- http://localhost:8080/up || exit 1
CMD ["frankenphp", "run", "--config", "/etc/caddy/Caddyfile"]
services:
app:
image: registry.example.com/myapp:${IMAGE_TAG:-latest}
container_name: myapp
restart: always
environment:
- APP_ENV=production
env_file:
- .env.production
ports:
- "127.0.0.1:8000:8000" # bind to loopback — nginx/caddy handles external
read_only: true # filesystem is read-only
tmpfs:
- /tmp # writable temp
- /run
depends_on:
db:
condition: service_healthy
networks:
- internal
deploy:
resources:
limits:
cpus: "1"
memory: 512M
db:
image: postgres:16-alpine
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
RUN commands to reduce layers: RUN apt-get update && apt-get install -y pkg && rm -rf /var/lib/apt/lists/*.dockerignore to exclude: .git, node_modules, *.log, tests/, docs/ENV or image layers — use Docker secrets or env file (not committed)127.0.0.1 if behind reverse proxy.dockerignore excludes sensitive filesConfigure structured JSON logging and send to stdout/stderr — let the orchestrator handle log routing:
LOG_FORMAT=json
LOG_LEVEL=info
Never write logs to files inside the container.