create-docker-entrypoint
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "create-docker-entrypoint" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-330b4ba1f5706f51bba3289f50d34b299a4f03922474cb5a7a7a243fe000e986. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Generate a Docker entrypoint script for a PHP container: create a startup script that implements signal handling, runs migrations, and warms application caches as part of container boot.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Generates Docker entrypoint scripts for PHP containers. Creates startup scripts with signal handling, migrations, and cache warmup.
- Testing
- Not tested
Browse files
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.
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供生产级 PHP 容器入口点脚本生成,涵盖信号处理、依赖等待、数据库迁移和缓存预热等关键功能
- 支持多种容器角色(Web、Worker、Scheduler),适配常见 PHP 框架(Symfony/Laravel)
Highlights
- 触发描述精准明确,关键词覆盖完整,边界清晰,用户可快速识别适用场景
Areas to improve
-
缺少 When to Use 和端到端使用示例 Reported severity: Minor
文档结构良好但未提供明确的使用场景说明和完整端到端示例
Recommendation: 建议补充 When to Use 章节和从生成到部署的完整流程示例
Highlights
- 文档结构清晰,分模块展示不同容器类型的入口点脚本
- 包含完整的 Dockerfile 集成和 Compose 配置示例
Highlights
- 脚本实现完善的信号处理和优雅停机机制
- 包含环境变量校验、依赖服务等待和错误处理逻辑
- 对不可逆操作(如数据库迁移)提供安全确认机制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.