create-docker-entrypoint
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "create-docker-entrypoint":https://skillpi.com/zh/skills/deepskill-330b4ba1f5706f51bba3289f50d34b299a4f03922474cb5a7a7a243fe000e986。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
为 PHP 容器生成 Docker 入口点脚本:创建用于容器启动的脚本,包含信号处理、数据库/迁移执行与应用缓存预热等启动步骤的实现。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: create-docker-entrypoint
description: Generates Docker entrypoint scripts for PHP containers. Creates startup scripts with signal handling, migrations, and cache warmup.Docker Entrypoint Generator
Generates entrypoint scripts for PHP Docker containers with signal handling, service readiness, and application bootstrap.
Generated Files
docker/
entrypoint.sh # Main web container entrypoint
entrypoint-worker.sh # Queue worker entrypoint
entrypoint-scheduler.sh # Cron scheduler entrypoint
wait-for-it.sh # Service readiness checker
Web Container Entrypoint (PHP-FPM)
#!/bin/bash
# entrypoint.sh — Web container entrypoint for PHP-FPM
set -eo pipefail
# ─── Signal Handling ────────────────────────────────────────
cleanup() {
echo "[entrypoint] Received shutdown signal, stopping gracefully..."
if [ -n "${FPM_PID}" ]; then
kill -SIGQUIT "${FPM_PID}" 2>/dev/null || true
wait "${FPM_PID}" 2>/dev/null || true
fi
echo "[entrypoint] Shutdown complete"
exit 0
}
trap cleanup SIGTERM SIGQUIT SIGINT
# ─── Environment Validation ────────────────────────────────
validate_env() {
local required_vars=("APP_ENV" "DATABASE_URL")
local missing=()
for var in "${required_vars[@]}"; do
if [ -z "${!var}" ]; then
missing+=("${var}")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
echo "[entrypoint] ERROR: Missing required environment variables: ${missing[*]}"
exit 1
fi
echo "[entrypoint] Environment: ${APP_ENV}"
}
# ─── Wait for Dependencies ─────────────────────────────────
wait_for_services() {
if [ -n "${DB_HOST}" ] && [ -n "${DB_PORT}" ]; then
echo "[entrypoint] Waiting for database at ${DB_HOST}:${DB_PORT}..."
/usr/local/bin/wait-for-it.sh "${DB_HOST}:${DB_PORT}" --timeout=60 --strict
fi
if [ -n "${REDIS_HOST}" ] && [ -n "${REDIS_PORT}" ]; then
echo "[entrypoint] Waiting for Redis at ${REDIS_HOST}:${REDIS_PORT}..."
/usr/local/bin/wait-for-it.sh "${REDIS_HOST}:${REDIS_PORT}" --timeout=30 --strict
fi
if [ -n "${RABBITMQ_HOST}" ] && [ -n "${RABBITMQ_PORT}" ]; then
echo "[entrypoint] Waiting for RabbitMQ at ${RABBITMQ_HOST}:${RABBITMQ_PORT}..."
/usr/local/bin/wait-for-it.sh "${RABBITMQ_HOST}:${RABBITMQ_PORT}" --timeout=60 --strict
fi
}
# ─── Database Migrations ───────────────────────────────────
run_migrations() {
if [ "${RUN_MIGRATIONS:-false}" = "true" ]; then
echo "[entrypoint] Running database migrations..."
# Framework-specific command (see references/entrypoint-patterns.md)
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration 2>&1 || {
echo "[entrypoint] ERROR: Migration failed"
exit 1
}
echo "[entrypoint] Migrations complete"
fi
}
# ─── Cache Warmup ──────────────────────────────────────────
warmup_cache() {
if [ "${APP_ENV}" = "prod" ]; then
echo "[entrypoint] Warming up cache..."
# Framework-specific command (see references/entrypoint-patterns.md)
php bin/console cache:warmup --env=prod --no-debug 2>&1 || {
echo "[entrypoint] WARNING: Cache warmup failed, continuing..."
}
echo "[entrypoint] Cache warmup complete"
fi
}
# ─── Fix Permissions ───────────────────────────────────────
fix_permissions() {
if [ -d "var" ]; then
chown -R www-data:www-data var/ 2>/dev/null || true
fi
if [ -d "storage" ]; then
chown -R www-data:www-data storage/ 2>/dev/null || true
fi
}
# ─── Main Execution ────────────────────────────────────────
echo "[entrypoint] Starting PHP-FPM container..."
validate_env
wait_for_services
fix_permissions
run_migrations
warmup_cache
echo "[entrypoint] Launching PHP-FPM..."
exec php-fpm --nodaemonize &
FPM_PID=$!
wait "${FPM_PID}"
Worker Container Entrypoint (Queue Consumer)
#!/bin/bash
# entrypoint-worker.sh — Queue worker entrypoint
set -eo pipefail
WORKER_PID=""
cleanup() {
echo "[worker] Received shutdown signal, draining worker..."
if [ -n "${WORKER_PID}" ]; then
kill -SIGTERM "${WORKER_PID}" 2>/dev/null || true
wait "${WORKER_PID}" 2>/dev/null || true
fi
echo "[worker] Worker stopped gracefully"
exit 0
}
trap cleanup SIGTERM SIGQUIT SIGINT
# Wait for dependencies
if [ -n "${DB_HOST}" ] && [ -n "${DB_PORT}" ]; then
/usr/local/bin/wait-for-it.sh "${DB_HOST}:${DB_PORT}" --timeout=60 --strict
fi
if [ -n "${RABBITMQ_HOST}" ] && [ -n "${RABBITMQ_PORT}" ]; then
/usr/local/bin/wait-for-it.sh "${RABBITMQ_HOST}:${RABBITMQ_PORT}" --timeout=60 --strict
fi
echo "[worker] Starting queue worker..."
WORKER_MEMORY_LIMIT="${WORKER_MEMORY_LIMIT:-128}"
WORKER_TIMEOUT="${WORKER_TIMEOUT:-60}"
WORKER_TRIES="${WORKER_TRIES:-3}"
WORKER_SLEEP="${WORKER_SLEEP:-3}"
# Framework-specific command (see references/entrypoint-patterns.md)
exec php bin/console messenger:consume async \
--memory-limit="${WORKER_MEMORY_LIMIT}M" \
--time-limit=3600 \
--limit=1000 \
-vv &
WORKER_PID=$!
wait "${WORKER_PID}"
Scheduler Container Entrypoint (Cron)
#!/bin/bash
# entrypoint-scheduler.sh — Cron scheduler entrypoint
set -eo pipefail
cleanup() {
echo "[scheduler] Shutting down cron..."
if [ -n "${CRON_PID}" ]; then
kill -SIGTERM "${CRON_PID}" 2>/dev/null || true
fi
exit 0
}
trap cleanup SIGTERM SIGQUIT SIGINT
# Wait for dependencies
if [ -n "${DB_HOST}" ] && [ -n "${DB_PORT}" ]; then
/usr/local/bin/wait-for-it.sh "${DB_HOST}:${DB_PORT}" --timeout=60 --strict
fi
# Install crontab
echo "[scheduler] Installing crontab..."
CRON_SCHEDULE="${CRON_SCHEDULE:-* * * * *}"
# Framework-specific (see references/entrypoint-patterns.md)
echo "${CRON_SCHEDULE} cd /app && php bin/console app:scheduler:run >> /var/log/cron.log 2>&1" \
| crontab -
# Start cron in foreground
echo "[scheduler] Starting cron daemon..."
exec crond -f -l 2 &
CRON_PID=$!
wait "${CRON_PID}"
Wait-for-it Script
#!/bin/bash
# wait-for-it.sh — Waits for a TCP host:port to become available
set -eo pipefail
TIMEOUT=30
STRICT=0
HOST=""
PORT=""
usage() {
echo "Usage: wait-for-it.sh host:port [--timeout=N] [--strict]"
exit 1
}
for arg in "$@"; do
case "${arg}" in
*:*)
HOST="${arg%%:*}"
PORT="${arg##*:}"
;;
--timeout=*)
TIMEOUT="${arg#*=}"
;;
--strict)
STRICT=1
;;
esac
done
[ -z "${HOST}" ] || [ -z "${PORT}" ] && usage
echo "Waiting for ${HOST}:${PORT} (timeout: ${TIMEOUT}s)..."
START_TIME=$(date +%s)
while ! nc -z "${HOST}" "${PORT}" 2>/dev/null; do
ELAPSED=$(( $(date +%s) - START_TIME ))
if [ "${ELAPSED}" -ge "${TIMEOUT}" ]; then
echo "ERROR: Timeout waiting for ${HOST}:${PORT} after ${TIMEOUT}s"
[ "${STRICT}" -eq 1 ] && exit 1
break
fi
sleep 1
done
echo "${HOST}:${PORT} is available"
exit 0
Dockerfile Integration
# Copy entrypoint scripts
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY docker/entrypoint-worker.sh /usr/local/bin/entrypoint-worker.sh
COPY docker/entrypoint-scheduler.sh /usr/local/bin/entrypoint-scheduler.sh
COPY docker/wait-for-it.sh /usr/local/bin/wait-for-it.sh
RUN chmod +x /usr/local/bin/entrypoint.sh \
/usr/local/bin/entrypoint-worker.sh \
/usr/local/bin/entrypoint-scheduler.sh \
/usr/local/bin/wait-for-it.sh
# Install netcat for wait-for-it
RUN apk add --no-cache netcat-openbsd
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"]
Docker Compose Service Definitions
services:
web:
build: .
entrypoint: /usr/local/bin/entrypoint.sh
environment:
RUN_MIGRATIONS: "true"
worker:
build: .
entrypoint: /usr/local/bin/entrypoint-worker.sh
deploy:
replicas: 2
scheduler:
build: .
entrypoint: /usr/local/bin/entrypoint-scheduler.sh
Generation Instructions
- Identify container roles: web (PHP-FPM), worker (queue), scheduler (cron)
- Detect framework: Symfony or Laravel for correct CLI commands
- List dependencies: database, cache, message broker
- Generate entrypoint scripts with signal handling and readiness checks
- Add Dockerfile COPY/RUN for entrypoint installation
See references/entrypoint-patterns.md for Symfony and Laravel specifics.
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供生产级 PHP 容器入口点脚本生成,涵盖信号处理、依赖等待、数据库迁移和缓存预热等关键功能
- 支持多种容器角色(Web、Worker、Scheduler),适配常见 PHP 框架(Symfony/Laravel)
亮点
- 触发描述精准明确,关键词覆盖完整,边界清晰,用户可快速识别适用场景
待提升项
-
缺少 When to Use 和端到端使用示例 原报告严重程度:轻微
文档结构良好但未提供明确的使用场景说明和完整端到端示例
改进建议:建议补充 When to Use 章节和从生成到部署的完整流程示例
亮点
- 文档结构清晰,分模块展示不同容器类型的入口点脚本
- 包含完整的 Dockerfile 集成和 Compose 配置示例
亮点
- 脚本实现完善的信号处理和优雅停机机制
- 包含环境变量校验、依赖服务等待和错误处理逻辑
- 对不可逆操作(如数据库迁移)提供安全确认机制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。